Reputation: 32
I have a knex chema migration to create a table, with the line -
exports.up = async function(knex) {
return knex.schema.createTable("newTable", table => {
table.timestamp("timestamp").notNullable();
})
}
I am getting an error ER_INVALID_DEFAULT: Invalid default value for 'timestamp'
I've tried to give a default of null and remove the notNullable() or a default of CURRENT_TIMESTAMP but nothing seems to work (maybe I have a wrong syntax?)
I'd appreciate any help!
Upvotes: 0
Views: 625
Reputation: 26
If you have access to my.ini (mysql conf file) remove the NO_ZERO_DATE from sql-mode and restart the server.
You can check it with SHOW VARIABLES LIKE 'sql_mode'
For the complete answer, follow the link
Upvotes: 1