diff --git a/src/sources/mysql/mysql-cast-rules.lisp b/src/sources/mysql/mysql-cast-rules.lisp index e53daa3..f05ecde 100644 --- a/src/sources/mysql/mysql-cast-rules.lisp +++ b/src/sources/mysql/mysql-cast-rules.lisp @@ -119,6 +119,10 @@ :target (:type "timestamptz" :drop-default t :drop-not-null t) :using pgloader.transforms::zero-dates-to-null) + (:source (:type "datetime" :on-update-current-timestamp t :not-null nil) + :target (:type "timestamptz" :drop-default t) + :using pgloader.transforms::zero-dates-to-null) + (:source (:type "timestamp" :default "0000-00-00 00:00:00" :not-null t) :target (:type "timestamptz" :drop-default t :drop-not-null t) :using pgloader.transforms::zero-dates-to-null) @@ -131,6 +135,10 @@ :target (:type "timestamptz" :drop-default t :drop-not-null t) :using pgloader.transforms::zero-dates-to-null) + (:source (:type "timestamp" :on-update-current-timestamp t :not-null nil) + :target (:type "timestamptz" :drop-default t) + :using pgloader.transforms::zero-dates-to-null) + (:source (:type "date" :default "0000-00-00") :target (:type "date" :drop-default t) :using pgloader.transforms::zero-dates-to-null) diff --git a/test/mysql/my.sql b/test/mysql/my.sql index 17cd3b6..a9daefd 100644 --- a/test/mysql/my.sql +++ b/test/mysql/my.sql @@ -100,6 +100,24 @@ create table bits insert into bits(bool) values(0b00), (0b01); +/* + * https://github.com/dimitri/pgloader/issues/811 + */ +CREATE TABLE `domain_filter` ( + `id` binary(16) NOT NULL , + `type` varchar(50) NOT NULL , + `value` json DEFAULT NULL , + `negated` tinyint(1) NOT NULL DEFAULT '0' , + `report_id` varbinary(255) NOT NULL , + `query_id` varchar(255) NOT NULL , + `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP , + `updated_at` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP , + `updated_by` varbinary(255) DEFAULT NULL , + PRIMARY KEY (`id`), + UNIQUE KEY `domain_filter_unq` (`report_id`,`query_id`,`type`), + KEY `domain_filter` (`type`) +) ENGINE=InnoDB DEFAULT CHARSET=ascii; + /* * https://github.com/dimitri/pgloader/issues/703 */