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
{{ message }}
Repository navigation
SQLite migrations lose foreign keys on any column change #5007
I have a migration that iteratively walks through a series of columns, renaming them. However, I found that if I run a series of remove/create column calls, only the last one in keeps its foreign key constraint.
I believe it has to do with Sequelize's way of moving data into a backup table, performing changes, and then moving it back.
I'm not sure if this is a problem in other dialects.
Likely not a problem with other dialects since they have actual schema change capabilities.
SQLite does not allow schema changes, the only way to do it is to backup, new table, transfer data.
Looks like there's a bug with the new table creation.
I was able to work around it by calling describeTable, manipulating the
description to be what I need the final table to be, dropping the source
table, and creating it from scratch with createTable
Not something I'd want to do in production of course, but then again I
won't be using SQLite in production :)
On Wed, Dec 9, 2015 at 10:01 AM, Mick Hansen [email protected]
wrote:
Likely not a problem with other dialects since they have actual schema
change capabilities.
SQLite does not allow schema changes, the only way to do it is to backup,
new table, transfer data.
Looks like there's a bug with the new table creation.
—
Reply to this email directly or view it on GitHub #5007 (comment)
.
Activity
mickhansen commentedon Dec 9, 2015
Likely not a problem with other dialects since they have actual schema change capabilities.
SQLite does not allow schema changes, the only way to do it is to backup, new table, transfer data.
Looks like there's a bug with the new table creation.
jocull commentedon Dec 9, 2015
I was able to work around it by calling
describeTable, manipulating thedescription to be what I need the final table to be, dropping the source
table, and creating it from scratch with
createTableNot something I'd want to do in production of course, but then again I
won't be using SQLite in production :)
On Wed, Dec 9, 2015 at 10:01 AM, Mick Hansen [email protected]
wrote:
sushantdhiman commentedon Jan 10, 2017
Moved to #7078