Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/techsneeze/dmarcts-report-parser.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTechSneeze <dave@techsneeze.com>2022-07-21 21:05:18 +0300
committerGitHub <noreply@github.com>2022-07-21 21:05:18 +0300
commit51ba1de8521559647ebe4b8a1db291c26b572de4 (patch)
tree7a563312dc16af8a536a36aca388a9150575c081 /dbx_mysql.pl
parent2af80e6a0ccc57bfe4e6bc8ae11c15b435c3d919 (diff)
parent06ee4a64f2b77fc622bf0bdb31325d54783666dd (diff)
Merge pull request #106 from ekalin/pgsqlHEADv2.0master
Add PostgreSQL support
Diffstat (limited to 'dbx_mysql.pl')
-rw-r--r--dbx_mysql.pl72
1 files changed, 72 insertions, 0 deletions
diff --git a/dbx_mysql.pl b/dbx_mysql.pl
new file mode 100644
index 0000000..3c72750
--- /dev/null
+++ b/dbx_mysql.pl
@@ -0,0 +1,72 @@
+%dbx = (
+ epoch_to_timestamp_fn => 'FROM_UNIXTIME',
+
+ to_hex_string => sub {
+ my ($bin) = @_;
+ return "X'" . unpack("H*", $bin) . "'";
+ },
+
+ column_info_type_col => 'mysql_type_name',
+
+ tables => {
+ "report" => {
+ column_definitions => [
+ "serial" , "int" , "unsigned NOT NULL AUTO_INCREMENT",
+ "mindate" , "timestamp" , "NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP",
+ "maxdate" , "timestamp" , "NULL",
+ "domain" , "varchar(255)" , "NOT NULL",
+ "org" , "varchar(255)" , "NOT NULL",
+ "reportid" , "varchar(255)" , "NOT NULL",
+ "email" , "varchar(255)" , "NULL",
+ "extra_contact_info" , "varchar(255)" , "NULL",
+ "policy_adkim" , "varchar(20)" , "NULL",
+ "policy_aspf" , "varchar(20)" , "NULL",
+ "policy_p" , "varchar(20)" , "NULL",
+ "policy_sp" , "varchar(20)" , "NULL",
+ "policy_pct" , "tinyint" , "unsigned",
+ "raw_xml" , "mediumtext" , "",
+ ],
+ additional_definitions => "PRIMARY KEY (serial), UNIQUE KEY domain (domain, reportid)",
+ table_options => "ROW_FORMAT=COMPRESSED",
+ indexes => [],
+ },
+ "rptrecord" => {
+ column_definitions => [
+ "id" , "int" , "unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY",
+ "serial" , "int" , "unsigned NOT NULL",
+ "ip" , "int" , "unsigned",
+ "ip6" , "binary(16)" , "",
+ "rcount" , "int" , "unsigned NOT NULL",
+ "disposition" , "enum('" . join("','", ALLOWED_DISPOSITION) . "')" , "",
+ "reason" , "varchar(255)" , "",
+ "dkimdomain" , "varchar(255)" , "",
+ "dkimresult" , "enum('" . join("','", ALLOWED_DKIMRESULT) . "')" , "",
+ "spfdomain" , "varchar(255)" , "",
+ "spfresult" , "enum('" . join("','", ALLOWED_SPFRESULT) . "')" , "",
+ "spf_align" , "enum('" . join("','", ALLOWED_SPF_ALIGN) . "')" , "NOT NULL",
+ "dkim_align" , "enum('" . join("','", ALLOWED_DKIM_ALIGN) . "')" , "NOT NULL",
+ "identifier_hfrom" , "varchar(255)" , ""
+ ],
+ additional_definitions => "KEY serial (serial, ip), KEY serial6 (serial, ip6)",
+ table_options => "",
+ indexes => [],
+ },
+ },
+
+ add_column => sub {
+ my ($table, $col_name, $col_type, $col_opts, $after_col) = @_;
+
+ my $insert_pos = "FIRST";
+ if ($after_col) {
+ $insert_pos = "AFTER $after_col";
+ }
+ return "ALTER TABLE $table ADD $col_name $col_type $col_opts $insert_pos;"
+ },
+
+ modify_column => sub {
+ my ($table, $col_name, $col_type, $col_opts) = @_;
+ return "ALTER TABLE $table MODIFY COLUMN $col_name $col_type $col_opts;"
+ },
+);
+
+1;