jeudi 2 août 2018

Keep code, database structure and database data in sync between revisions

This issue has been bothering me for a while and it seems to be a tough question to Google.

I am looking for the best (or at least a decent) way to keep my code, my database structure and the database data in sync with eachother. I am currently using Laravel 5 which provides me with migrations and seeds. The first is excellent for database structure changes. The latter seems ok, but does not take time in consideration.

So I have this laravel installation which I set up a few months ago. It has 20ish tables and a few seeder files. Now I renamed a column in the existing table structure.

When I start my Laravel site from scratch, I obviously run the migrations first or there will be no tables at all. After that I run my seeds and fail on the insert query for the changed column.

The question arises: shouldn't seeders be time-dependent of migrations? Or should change ALL seeds when a database structure change is made? There must be a better way, am i missing something? How should this be done?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire