Laravel Too Many Migration Files: Is It A Problem?

preview_player
Показать описание
If you have a lot of files in the database/migrations folder, is it a big deal, or you can ignore it as not a problem? Let's discuss this.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

whenver i watch your video, you always tell a new thing about laravel which we don't know before 😄😄

dfordemo
Автор

Having a lot of migrations is not a problem as long as you can find your migrations easily in my opinion

twentyhate
Автор

HUGE thanx!
Relevant right now at current moment today!

webdev
Автор

Nice! Just what I need after starting to do TDD

SleepyChoco
Автор

More important is the time it takes to seed the database. On larger projects this can take some minutes and slowing down the testing pipelines.

OliverKurmis
Автор

Thank you for the tip about clicking on Migrations folder and typing - very useful.

VadimBesedin
Автор

I agree for the most part, but there's one more use case where migration speed matters. Multi-db multitenancy. If you're migrating 100s or 1000s of tenant databases every millisecond matters

binaryfire
Автор

For auto testing you may use db transactions and run migrations separately with php artisan migrate --env=testing (if you have .env.testing). Than you don't need to have prepared schema for each test. But feature with schema is something new for me, thanks)

rdavydov
Автор

Hi again, I have a different question, look I want to import a big mysql with a lot of data into xampp but I have an error timeout, even though I try to increase the variables xampp but it still doesn't work. do you have any idea to import MySQL?

hadizarrabi
Автор

Thanks. Always been looking for a way to speedup the 100's of migrations we have.

chan
Автор

Hi, thanks for your lesson, but when you have a big project with big data how will you run it? imagine you have a database with 100 tables and each of them has 800, 000 rows. do you have any suggestions?

hadizarrabi
Автор

for me, during development and still haven't deployed to "production",
I rename the migration files into 00_00_00_00_file_name.php and then keep on updating the file if I want to remove or add more fields to the table and just refreshing the database after it.

that's how I keep my migration files low

cykablyatii
Автор

The number of migrations was never an issue, but it is GREAT to know there's a good solution to it if that problem ever occurs. This is what I like about Laravel, they think about almost anything! Thanks for the video! I just followed you on twitter as well.

kickass
Автор

Thanks for this, I hadn't thought about using dump to speed up automated testing. My current project has 300+ tests & only take about 90 seconds, but this may speed up by using dump.

tetleyk
Автор

Extremely good example of migration for testing, is amazing idea to dump database. Unfortunately is for Laravel 8 or higher 😢

corinalozan
Автор

I always rename the migrations bij altering the DateTimeStamp (at the beginning) so the migrations group and order in a readable fashion.
In some projects I also run migrations (:fresh --seed) daily because it pulls data from the production server and seeds it into my local development server.

kreaweb-be
Автор

I don't think it's a big problem. I encourage my team members to write migration file for each and every database changes they make, unless the table isn't ready or deployed in production. For changes in every table in local, staging environment we have one UI where we put SQL script to update the database. Which isn't perfect but it gets the job done and we are happy so far.

dutchman
Автор

Mysqldump not an internal external comman.
Changed the system env variables still got the same issue

mohammadimranmir
Автор

For readability, is it possible to use IDE custom snippets to hide timestamps?

gausoft
Автор

If you dump the schema, can you then delete the old migration files and then simply use the schema from then on?
So if I have 200 migration files and I dump the schema, can I then delete those migration files and simply use the schema and new migration files I created from thereon out?

Thanks :)

AlexTheGreatish