mysql2sqlite icon indicating copy to clipboard operation
mysql2sqlite copied to clipboard

Fix columns with utc_timestamp default

Open c9845 opened this issue 5 years ago • 0 comments

Replace utc_timestamp with CURRENT_TIMESTAMP.

MySQL allows using UTC_TIMESTAMP as the default value for a column (i.e. DatetimeCreated DATETIME DEFAULT UTC_TIMESTAMP). This is useful in MySQL since the timezone of the default value will always be UTC. Compare this against using CURRENT_TIMESTAMP where the timezone of the default value will be the timezone of the system or server.

UTC_TIMESTAMP does not exists in SQLite; SQLite only uses CURRENT_TIMESTAMP and it returns a value in the UTC timezone. So if we want to convert from MySQL to SQLite, we need to convert UTC_TIMESTAMP to CURRENT_TIMESTAMP.

c9845 avatar Aug 24 '20 18:08 c9845