Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@alexbrooklyn From what I know and been told there not recommended as they can easily break.
I'm doing an upgrade to rails 6 and they all pretty much stopped working. So instead of working on the update, I've had to spend the past two days clearing out the data based migrations and move them all over to seeds.rb file. 847 migrations, almost done. -
Crost40744yI don't think it's bad to seed in a migration. It has to be readable though. if I want to create a list of supported currencies why wouldn't I do it in a migration?
-
If it is a fixed insert... Okay....
But computing values and inserting....
Oh boy. You're standing in a pool of diarrhea.
From rounding errors (language defaults can change, settings too) to change of behavior to ....
Even if I tried to understand that merge fuckity above I don't think I'd be able to find all the subtle nuances where this can break in most spectacular ways. -
@IntrusionCM my point exactly, change the database structure and modifying data that makes sense adding data using migrations to me doesn’t really make a lot of sense to me. I’ve gotten though a lot of the migrations just the migrations from this year are left.
-
mundo0349114y@alexbrooklyn yes you can add seed data on a migration, but make sure the migration is outside of the regular migrations.
So just make sure you meed to run that migration manually.
It's all good if you know what you are doing.
Related Rants
So my last rant was regarding a piece of code I found while clearing up an app. Here's the newest edition... a recent migration I found... a class within a migration creating records, this is not what migrations are for haha you don't add data using migrations jeez help me.
rant
ruby
rails
why
help
bad code