@@ -1,4 +1,4 @@
1−use super::{Action, MigrationContext};
1+use super::{common, Action, MigrationContext};
22use crate::{
33 db::{Conn, Transaction},
44 schema::Schema,
@@ -92,6 +92,19 @@ impl Action for RemoveColumn {
9292 ctx: &MigrationContext,
9393 db: &'a mut dyn Conn,
9494 ) -> anyhow::Result<Option<Transaction<'a>>> {
95+ let indices = common::get_indices_for_column(db, &self.table, &self.column)
96+ .context("failed getting column indices")?;
97+
98+ for index in indices {
99+ db.run(&format!(
100+ "
101+ DROP INDEX CONCURRENTLY IF EXISTS {name}
102+ ",
103+ name = index.name,
104+ ))
105+ .context("failed to drop index")?;
106+ }
107+
95108 // Remove column, function and trigger
96109 let query = format!(
97110 r#"