sqlmigrator.go
sqlmigrator.go - Overview
-
Overview Defines the
SQLMigrator
interface for managing database migrations, including methods for migrating and rolling back changes. -
Detailed Documentation
SQLMigrator Interface
- Purpose: Defines the contract for migrating and rolling back database changes.
Migrate
- Purpose: Migrates the database to the latest version. It acquires a lock to prevent concurrent migrations.
- Parameters:
ctx
(context.Context): Context for controlling the execution, allowing for cancellation and timeouts.
- Returns:
error
: An error if the migration fails,nil
otherwise.
Rollback
- Purpose: Rolls back the database to a previous state. It acquires a lock to prevent concurrent rollbacks.
- Parameters:
ctx
(context.Context): Context for controlling the execution, allowing for cancellation and timeouts.
- Returns:
error
: An error if the rollback fails,nil
otherwise.
Include in Getting Started: NO