mysql2sqlite
mysql2sqlite copied to clipboard
Fix columns with utc_timestamp default
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.