We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is more a knex issue than sails-migrations issue, but wanted to have the issue documented for future users. http://knexjs.org/#Schema-timestamps
table.timestamps() creates created_at and updated_at while sails is expecting createdAt and updatedAt
table.timestamps()
created_at
updated_at
createdAt
updatedAt
table.timestamp('createdAt'); table.timestamp('updatedAt');
Create a migration for fixing the erroneous columns (sails-migrations generate fix_timestamps)
sails-migrations generate fix_timestamps
'use strict'; exports.up = function(knex, Promise) { function renameUp(table) { table.renameColumn('created_at', 'createdAt') .renameColumn('updated_at', 'updatedAt'); } Promise.all([ knex.schema.table('myTable', renameUp) ]); }; exports.down = function(knex, Promise) { function renameDown(table) { table.renameColumn('createdAt', 'created_at') .renameColumn('updatedAt', 'updated_at'); } Promise.all([ knex.schema.table('myTable', renameDown) ]); };
The text was updated successfully, but these errors were encountered:
knex/knex#754
Sorry, something went wrong.
nice catch.. i wonder if we can fix that in some way..
Might be able to hook into our knex object and overwrite it.
yeah, seems like there is no easy way to configure it.. hmm, we could patch that before it's passed to the function
No branches or pull requests
This is more a knex issue than sails-migrations issue, but wanted to have the issue documented for future users. http://knexjs.org/#Schema-timestamps
Issue:
table.timestamps()
createscreated_at
andupdated_at
while sails is expectingcreatedAt
andupdatedAt
Resolutions:
table.timestamps()
:table.timestamps()
:Create a migration for fixing the erroneous columns (
sails-migrations generate fix_timestamps
)The text was updated successfully, but these errors were encountered: