same as me. I’m using Mysql 8. this is mine
const TABLE = 'articles';
async function up(knex) {
return knex.schema.alterTable(TABLE, function(t) {
t.dateTime('published_date', { precision: 6 }).defaultTo(knex.fn.now(6)).alter();
});
}
async function down() { }
module.exports = { up, down };
I tried raw query but no luck
return knex.raw(`ALTER TABLE ${TABLE} MODIFY COLUMN published_date datetime DEFAULT CURRENT_TIMESTAMP NULL`)
UPDATE: after a test by throwing an error right before alter table, I saw that strapi will update the table again follow the schema config json.