3 ms·
At that point it's painfully easy to create a situation where your manual migration depends on properties of your model that have since changed. I don't unders
by moe 16y ago
At that point it's painfully easy to create a situation where your manual migration depends on properties of your model that have since changed.
I don't understand the situation you're describing. The migration-files, once created, are independent from the model. That means you can re-run the chain at any point in time, regardless of what your current model looks like.
Having an auto-generator for the migration files doesn't change that.
- snprbob86 16y agoHe's making the same mistake I once made: Trying to use his models from the migrations. I'd really like to see Rails raise a deprecation warning if a model gets dynamically loaded by a migration....
- jarin 16y agoEvery Rails developer makes that mistake once (well, hopefully not more than once). What I'd really like to see next is a way to version seeds.rb.
- foca 16y agogit?
- jarin 16y agoseeds.rb isn't intended to be run more than once on a particular database instance. Running it more than once results in duplicate entries, unless you're explicitly checking for dupes (not always possible). It looks like seedbank is fairly close to what I want though, as it lets you maintain multiple sets of seeds: https://github.com/james2m/seedbank https://github.com/james2m/seedbank
- james2m 16y ago@Jarin I've been thinking about versioning seeds or at least being able to alter / update in place seeds. Did you have any thoughts on how you would like the versioning to work?