Rollback
Rolls back the most recently applied migration for the given prefix by executing its corresponding _down.sql file from the provided fs.FS.
def Rollback(
ctx: context.Context,
db: *sqlx.DB,
prefix: string,
migrations: fs.FS
) - > error
Rolls back the most recently applied migration for the given prefix by executing its corresponding _down.sql file from the provided fs.FS.
Parameters
| Name | Type | Description |
|---|---|---|
| ctx | context.Context | The context for the database operations, allowing for cancellation and timeouts. |
| db | *sqlx.DB | The database connection pool to execute the rollback migration against. |
| prefix | string | The prefix used to identify and filter the relevant migrations in the schema_migrations table. |
| migrations | fs.FS | The file system containing the migration files, including the _down.sql file for the rollback. |
Returns
| Type | Description |
|---|---|
error | An error if the rollback fails at any stage, otherwise nil. |