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
createTable should allow close to copy paste from Model definition #5213
changed the title [-]createTable should allow copy paste from Model definition[/-][+]createTable should allow close to copy paste from Model definition[/+]on Jan 13, 2016
I have written a "migration schema generator" which uses models a few days ago. Works fine with several dataTypes (STRING, TEXT, INTEGER, BOOLEAN, ENUM, DATETIME) and since I'm using the SET FOREIGN_KEY_CHECK = 0 workaround even foreign key constraints are working.
My last problem (and I haven't found a solution yet) are indexes because I just haven't found the index definition anywhere in the model. Maybe you can help? models[model].indexes is undefined :(
Ok, I have just found them in models[model].options.indexes :)
Maybe you want consider to offer an official "migration file generator" instead of changing the createTable interface? (Just an idea)
A really awesome feature would be if you could compare two models and create a diff file to use with db:migrate - so you can automatically create a new migrationfile by comparing an old and a new model!
What you suggest is something we'd like to do.
We'd like to be able to diff a model against a database and generate a structure that can be formatted into a migration or a query or whatever.
Diffing between two models could work off that, the question is how you show the two models at the same time though (git?)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂
Activity
[-]createTable should allow copy paste from Model definition[/-][+]createTable should allow close to copy paste from Model definition[/+]manuelbieh commentedon Jan 21, 2016
I have written a "migration schema generator" which uses models a few days ago. Works fine with several dataTypes (STRING, TEXT, INTEGER, BOOLEAN, ENUM, DATETIME) and since I'm using the
SET FOREIGN_KEY_CHECK = 0workaround even foreign key constraints are working.My last problem (and I haven't found a solution yet) are indexes because I just haven't found the index definition anywhere in the model. Maybe you can help?
models[model].indexesis undefined :(The generator:
https://gist.github.com/manuelbieh/ae3b028286db10770c81
manuelbieh commentedon Jan 21, 2016
Ok, I have just found them in
models[model].options.indexes:)Maybe you want consider to offer an official "migration file generator" instead of changing the createTable interface? (Just an idea)
A really awesome feature would be if you could compare two models and create a diff file to use with db:migrate - so you can automatically create a new migrationfile by comparing an old and a new model!
mickhansen commentedon Jan 21, 2016
What you suggest is something we'd like to do.
We'd like to be able to diff a model against a database and generate a structure that can be formatted into a migration or a query or whatever.
Diffing between two models could work off that, the question is how you show the two models at the same time though (git?)
manuelbieh commentedon Jan 21, 2016
Good point. Diffing against a database makes more sense 👍
stale commentedon Aug 12, 2017
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment 🙂