List and delete migration from rails console
Sure! Here is a response without personal words or sentences at the beginning and end of my reply:
To list all migrations in the Rails console, you can use the following command:
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrations.map(&:name)
To delete a specific migration from the Rails console, you can use the following command:
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).down("NameOfMigration")
Replace "NameOfMigration" with the actual name of the migration you want to delete.