Back

just felt the need to actually test a migration—like literally write a test for an “add_slug_columns.php” migration.

anyone else ever had this need or something similar? specially because this migration will actually put data on this new column. 🤔

2

474

How do you approach migrations that require to add or alter data? We used to do it in the migration itself but later moved to keep the migration for changibg the schema and creating a seeder for the data manipulation. Never been happy with either solurion.

1

77

Why don't you like the second solution?

1

96

Just because I need to remember to run the seeder in order to populate/fix the data. It's not obvious, and also that means running a seeder on production, and when you see the promt asking if you are sure... I always get cold feet 😅

That's why I'm curious how you approach this.

1

59

I sometimes use a command instead of a seeder, to create some specific records. But that's still something you need to remember to run. Not sure if there's a smarter/frictionless solution.
Maybe you could just add a memo in the README of the project: "when this happens, add these records to the XY table: ..."

2

166

In response to @mloru

Yep, we used to use commands in the past, but we moved to use seeders. It's usually a run it one time fix, and we do not want to overcrowd the commands namespace with this kind of actions.

97

  • No matching results...
  • Searching...

/ 1000