Let's say I use Laravel 5.7 with Passport, and while I'm developing, I create migrations for my models, then I create Clients and tokens data in Passport tables. Now the migrations table looks like this :
+----+--------------------------------------------------------------+-------+
| id | migration | batch |
+----+--------------------------------------------------------------+-------+
| 34 | 2014_10_12_000000_create_users_table | 1 |
| 35 | 2014_10_12_100000_create_password_resets_table | 1 |
| 36 | 2016_06_01_000001_create_oauth_auth_codes_table | 1 |
| 37 | 2016_06_01_000002_create_oauth_access_tokens_table | 1 |
| 38 | 2016_06_01_000003_create_oauth_refresh_tokens_table | 1 |
| 39 | 2016_06_01_000004_create_oauth_clients_table | 1 |
| 40 | 2016_06_01_000005_create_oauth_personal_access_clients_table | 1 |
| 41 | 2018_12_30_232223_create_table_entreprises | 1 |
| 42 | 2018_12_30_232703_create_table_dossiers | 1 |
| 43 | 2018_12_30_232823_create_table_type_entreprises | 1 |
| 44 | 2018_12_30_232906_create_table_groups | 1 |
| 45 | 2018_12_30_232922_create_table_menus | 1 |
| 46 | 2019_01_01_160217_create_table_cips | 1 |
+----+--------------------------------------------------------------+-------+
So the first 7 migrations are for Laravel, including Passport, which I don't need to modify. But Now, If I want to change entreprises
migrations, then I need to rollback. All migrations are batch 1, so all tables will be lost, including passport clients and token. Even if I migrate in 2 times, let's say entreprises
migration has batch 2, I can safely rollback, but I can't use command like php artisan migrate:refresh --seed
that will rollback the 2 batches.
Is there a way like updating some migrations batch to 0
or -1
or NULL
that could :
- Ignore rollback for those migrations
- Ignore migrate again for those migrations?
It's for development only as production won't need to rollback with existing data.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire