![Luke Kuzmish Profile](https://pbs.twimg.com/profile_images/1728060242917838848/3KVvter4_x96.jpg)
Luke Kuzmish
@cosmastech
Followers
90
Following
824
Statuses
243
Joined November 2023
This post prompted me to take a stab at a PR for skipping migrations in test cases. I know @enunomaduro had asked here how other people test migrations.
Hot debate: Should Laravel migrations have a down method? π€ π’ Pro: It's great for devs who need to rollback and migrate locally, offering a safety net for testing. π΄ Con: There's a risk of accidentally rolling back a production database, which could be disastrous. I'm in the camp that says NO to down methods by default. Instead, use `migrate:fresh` whenever you need a clean start! But, if you still insist on having the rollback functionality, you can add down methods and safeguard your production environment by using `RollbackCommand::prohibit()`. This way, you can enjoy peace of mind about your database integrity! And you can also avoid other db:unsafe commands with `DB::prohibitDestructiveCommands($this->app->isProduction());` too! What are your thoughts on this? π€ Comment your views below! π
1
2
4
I think in most enterprise/businesses you would: * migrate:rollback * revert the commit(s) * fix the problem rapidly * review the fix * deploy again * run the new migration * have a post-mortem to figure out what allowed the problem to slip through the cracks and how it can be avoided in the future In my current position, there's the added problem of CI/CD pipelines. Say pipelines take 5-10 minutes to run. * pipeline for the PR * PR requires review/approval from another dev * pipeline to deploy to staging * pipeline to deploy to master That's 15-30 minutes just to push another migration to production. And if someone made a mistake in the original migration, the reviewer should apply more scrutiny to the next one. (Does it actually fix the problem? Is my DB in a state similar enough to production that I can confirm it resolves the issues? What are the potential side effects?) So, we just write `down` methods π€£
1
0
2
Mac OS (personal and work). It appears to be working just fine using the Herd's PHP version. To note: I had been using Herd for a while and then upgraded to Herd Pro. This may be part of the problem? Would you mind shooting me the link to the docs for setting up PHPStorm to make sure I've followed all the steps. ππ» I looked yesterday but may have missed something.
0
0
0
@themsaid I think this is the first time Iβve seen Go code where every variable wasnβt represented by 1-3 inscrutable letters. π This is much more readable.
1
0
1
@ste_bau Yes. We use @spatie_beβs laravel-data package, so itβs much less expensive to spin test the request validation
0
0
1
@josephkerkhof @yacineMTB Are you kneeling because I dropped the ball and you have to pick it up? π
0
0
1
@ste_bau @mateusjatenee I think the hardest part of ActiveRecord is that the functions under test may leverage magic properties (like loading child relationships), or you have to spin up complicated database scenarios. I've thought of something like this, but it's also bad.
0
0
1
@sifrious I built something like this for a non-profit org. We use Twilio. To make it simple, I set an admin phone number. Any text sent from that phone number gets re-broadcast to everyone on the list.
0
0
1