Skip to content

Commit

Permalink
docs: fix missing self in down migration example of readme
Browse files Browse the repository at this point in the history
fixes #41

Signed-off-by: Saurav Sharma <[email protected]>
  • Loading branch information
iamsauravsharma committed Jan 12, 2025
1 parent db33b26 commit 5a9e688
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Operation<sqlx::Postgres> for FirstOperation {
}

// down migration runs down migration
async fn down(connection: &mut sqlx::PgConnection) -> Result<(), Error> {
async fn down(&self, connection: &mut sqlx::PgConnection) -> Result<(), Error> {
sqlx::query("DROP TABLE sample").execute(connection).await?;
Ok(())
}
Expand Down
5 changes: 3 additions & 2 deletions src/migrator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,11 @@ where
match plan.plan_type {
PlanType::Apply => {
tracing::debug!("applying {} : {}", migration.app(), migration.name());
let operations = migration.operations();
if migration.is_atomic() {
let mut transaction = connection.begin().await?;
if !plan.fake {
for operation in migration.operations() {
for operation in operations {
operation.up(&mut transaction).await?;
}
}
Expand All @@ -882,7 +883,7 @@ where
transaction.commit().await?;
} else {
if !plan.fake {
for operation in migration.operations() {
for operation in operations {
operation.up(connection).await?;
}
}
Expand Down

0 comments on commit 5a9e688

Please sign in to comment.