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.

  • 1
    I've added seed data and operations in migration before. Are they that bad?
  • 0
    @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.
  • 0
    Nanidafucc? 👀
    Yeah sure, fuck these seeders 🤦‍♂️/s
  • 1
    I 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?
  • 0
    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.
  • 0
    @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.
  • 0
    @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.
  • 0
    Who the fuck does that. Omg
Add Comment