php - Rollback a particular migration? -
is possible rollback particular migration in laravel?
for example:
if make 4 migration m1, m2, m3 , m4 , later decided add more fields in m2. can roll way directly m2? or edit existing m2 migration file directly?
the best practice @farkie's comment, create new migration. if want hack, way laravel rollbacks migrations this: on migrations tables there column called 'batch' when rollback executed records biggest batch number rollbacked , records of rollbacked migrations deleted migrations table.
a way hack be:
if migrations table like:
migration | batch =========================== m1 | 1 m2 | 1 m3 | 1 m4 | 1 edit table looks like
migration | batch =========================== m1 | 1 m2 | 2 m3 | 2 m4 | 2 so when rolling rollback m2, m3 , m4, changes , migrate again
Comments
Post a Comment