File tree 2 files changed +17
-6
lines changed
2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -22,17 +22,20 @@ def handle(self):
22
22
)
23
23
migration .create_table_if_not_exists ()
24
24
table = self .table ()
25
- table .set_header_row (["Ran?" , "Migration" ])
25
+ table .set_header_row (["Ran?" , "Migration" , "Batch" ])
26
26
migrations = []
27
27
28
- for migration_file in migration .get_ran_migrations ():
28
+ for migration_data in migration .get_ran_migrations ():
29
+ migration_file = migration_data ["migration_file" ]
30
+ batch = migration_data ["batch" ]
31
+
29
32
migrations .append (
30
- ["<info>Y</info>" , f"<comment>{ migration_file } </comment>" ]
33
+ ["<info>Y</info>" , f"<comment>{ migration_file } </comment>" , f"<info> { batch } </info>" ]
31
34
)
32
35
33
36
for migration_file in migration .get_unran_migrations ():
34
37
migrations .append (
35
- ["<error>N</error>" , f"<comment>{ migration_file } </comment>" ]
38
+ ["<error>N</error>" , f"<comment>{ migration_file } </comment>" , "<info>-</info>" ]
36
39
)
37
40
38
41
table .set_rows (migrations )
Original file line number Diff line number Diff line change @@ -118,8 +118,16 @@ def get_ran_migrations(self):
118
118
119
119
database_migrations = self .migration_model .all ()
120
120
for migration in all_migrations :
121
- if migration in database_migrations .pluck ("migration" ):
122
- ran .append (migration )
121
+ matched_migration = database_migrations .where (
122
+ "migration" , migration
123
+ ).first ()
124
+ if matched_migration :
125
+ ran .append (
126
+ {
127
+ "migration_file" : matched_migration .migration ,
128
+ "batch" : matched_migration .batch ,
129
+ }
130
+ )
123
131
return ran
124
132
125
133
def migrate (self , migration = "all" , output = False ):
You can’t perform that action at this time.
0 commit comments