3 ms·
That works until a method you reference in the migration changes or doesn't exist anymore. For instance, a model you're working with might not expose some of th
by haukur 11y ago
That works until a method you reference in the migration changes or doesn't exist anymore. For instance, a model you're working with might not expose some of the methods you're working with or a library has been modified, but it's being used in the migration. Obviously this is something that people should try to avoid, but I once found myself in the position of having to do checkout to some specific commits in the history in order to be able to run migrations at a past project. In the end I found myself repeating the process once too often and created a gem for it: https://github.com/hph/farfugl https://github.com/hph/farfugl. This is for Rails migrations but the concept is the same in any library or language, you just have to go to the commit where the migration originates from.
As a side note, I've been using Sequelize for a year now and it can often be pretty annoying. Both the query interface and the migrations are subpar when compared to Rails. For instance:
Model.find({ id: 1}) // or maybe just Model.find(1)!
vs. (the Sequelize syntax)
Model.find({ where: { id: 1 } })
Forgetting the "where" above doesn't even raise an error, it just silently fails.
- k__ 11y agoFor IDs you can use Model.find(1)