File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -1074,8 +1074,19 @@ class StatBus
10741074 private def execute_down_migration (db , down_path : Path , version : String )
10751075 Dir .cd(@project_directory ) do
10761076 migration = MigrationFile .parse(down_path)
1077- result = system(" ./devops/manage-statbus.sh psql --variable=ON_ERROR_STOP=on < #{ down_path } " )
1078- if result
1077+
1078+ # Check if migration file is empty (size 0)
1079+ if File .size(down_path) == 0
1080+ puts " Skipping empty migration #{ down_path } " if @verbose
1081+ # Remove the migration record without running the file
1082+ versions = db.query_all(<<-SQL , version, as : {version: String})
1083+ DELETE FROM db .migration
1084+ WHERE version = $1
1085+ RETURNING version;
1086+ SQL
1087+ else
1088+ result = system(" ./devops/manage-statbus.sh psql --variable=ON_ERROR_STOP=on < #{ down_path } " )
1089+ if result
10791090 # Remove the migration record(s)
10801091 versions = db.query_all(<<-SQL , version, as : {version: String})
10811092 DELETE FROM db .migration
You can’t perform that action at this time.
0 commit comments