mirror of
https://github.com/dimitri/pgloader.git
synced 2026-05-04 10:31:02 +02:00
Add more default rules to MySQL datetime handling.
Given the variety of ways to setup default behavior for datetime and timestamp data types in MySQL, we need yet more default casting rules. It might be time to think about a more principled way to solve the problem, but on the other hand, this ad-hoc one also comes with full overriding flexibility for the end user. Fixes #811.
This commit is contained in:
parent
1844823bce
commit
46d14af0d3
@ -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)
|
||||
|
||||
18
test/mysql/my.sql
vendored
18
test/mysql/my.sql
vendored
@ -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
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user