aboutsummaryrefslogtreecommitdiffstats
path: root/internal/repositories/migration_db_repo.go
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-01-13 18:23:48 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2024-01-13 18:23:48 -0500
commit00aa327eb204d504f1e03dbe5a7cdec4af4ec913 (patch)
tree571a5bc5ce52a11e0039f9763c89b9316e7bf9d4 /internal/repositories/migration_db_repo.go
parentTweak readme (diff)
downloadcli-00aa327eb204d504f1e03dbe5a7cdec4af4ec913.zip
Rework docs, add more output, and tweak tests
Diffstat (limited to 'internal/repositories/migration_db_repo.go')
-rw-r--r--internal/repositories/migration_db_repo.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/internal/repositories/migration_db_repo.go b/internal/repositories/migration_db_repo.go
index 7f8fc10..6a37e7b 100644
--- a/internal/repositories/migration_db_repo.go
+++ b/internal/repositories/migration_db_repo.go
@@ -83,7 +83,10 @@ func (mr *MigrationDBRepo) IsApplied(version string) (applied bool, err error) {
// and adding the applied migration version into the migrations table. When
// successfully applied, the `migration` model's `Applied` field will be set
// to true.
-func (mr *MigrationDBRepo) Apply(upgradeScript string, migration *models.Migration) error {
+func (mr *MigrationDBRepo) Apply(
+ upgradeScript string,
+ migration *models.Migration,
+) error {
tx, err := mr.db.Begin()
if err != nil {
return err
@@ -114,7 +117,10 @@ func (mr *MigrationDBRepo) Apply(upgradeScript string, migration *models.Migrati
// Revert reverts a migration by executing the corresponding downgrade script
// and deleting the migration version from the migrations table. When successfully
// reverted, the `migration` model's `Applied` field will be set to false.
-func (mr *MigrationDBRepo) Revert(downgradeScript string, migration *models.Migration) error {
+func (mr *MigrationDBRepo) Revert(
+ downgradeScript string,
+ migration *models.Migration,
+) error {
tx, err := mr.db.Begin()
if err != nil {
return err