You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: ER_INVALID_DEFAULT: Invalid default value for 'search_date'
at Function.get (/Users/glenn/Developer/apollo/yelp-core/node_modules/knex/lib/util/make-knex.js:42:26)
at Object.exports.down (/Users/glenn/Developer/apollo/yelp-core/db/knex_migrations/20200801195748_create_search_terms.js:37:15)
at /Users/glenn/Developer/apollo/yelp-core/node_modules/knex/lib/migrate/Migrator.js:543:36
at /Users/glenn/Developer/apollo/yelp-core/node_modules/knex/lib/transaction.js:184:22
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Reduced test code
exports.up=function(knex){returnknex.schema.createTable('my_table',function(t){t.increments().primary();// this is now valid as of MySQL 8.0.13, but migrate:down complains saying invalid default// migrate:up works perfectly fine. Inserting into table yields proper default datet.date('search_date').defaultTo(knex.raw('(CURRENT_DATE)'));});};exports.down=function(knex){returnknex.schema.dropTable(name);// the error gets thrown here};
The text was updated successfully, but these errors were encountered:
nogurenn
changed the title
MySQL 8.0.13 CURRENT_DATE as default throws ER_INVALID_DEFAULT at migrate:down
MySQL 8.0.13 CURRENT_DATE as default knex throws ER_INVALID_DEFAULT at migrate:down
Aug 1, 2020
Environment
Knex version: 0.21.2
Database + version: MySQL 8.0.19
OS: Mac OS 10.14.6
Bug
down()
would work as expected after running in the CLI. MySQL supportsCURRENT_DATE
as default value for DATE columns as of 8.0.13. See https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html#data-types-defaults-explicitThe text was updated successfully, but these errors were encountered: