diff --git a/lib/actual_db_schema/patches/migration_context.rb b/lib/actual_db_schema/patches/migration_context.rb index 6db97c1..df35bad 100644 --- a/lib/actual_db_schema/patches/migration_context.rb +++ b/lib/actual_db_schema/patches/migration_context.rb @@ -79,6 +79,8 @@ def show_info_for(migration) end def migrate(migration) + migration.name = extract_class_name(migration.filename) + message = "[ActualDbSchema] Rolling back phantom migration #{migration.version} #{migration.name} " \ "(from branch: #{branch_for(migration.version.to_s)})" puts colorize(message, :gray) @@ -89,6 +91,11 @@ def migrate(migration) File.delete(migration.filename) end + def extract_class_name(filename) + content = File.read(filename) + content.match(/^class\s+([A-Za-z0-9_]+)\s+