From 07545558034a1e056ae7af51623a5d55a41a5d1a Mon Sep 17 00:00:00 2001 From: laker-93 Date: Thu, 17 Apr 2025 16:26:45 +0100 Subject: [PATCH] patch db (#6) --- ...plicate.go => 20241025222849_duplicate.go} | 0 .../20241025301254_remove_duplicate.go | 26 +++++++++++++++++++ 2 files changed, 26 insertions(+) rename db/migrations/{20241227222849_duplicate.go => 20241025222849_duplicate.go} (100%) create mode 100644 db/migrations/20241025301254_remove_duplicate.go diff --git a/db/migrations/20241227222849_duplicate.go b/db/migrations/20241025222849_duplicate.go similarity index 100% rename from db/migrations/20241227222849_duplicate.go rename to db/migrations/20241025222849_duplicate.go diff --git a/db/migrations/20241025301254_remove_duplicate.go b/db/migrations/20241025301254_remove_duplicate.go new file mode 100644 index 000000000..d322b559e --- /dev/null +++ b/db/migrations/20241025301254_remove_duplicate.go @@ -0,0 +1,26 @@ +package migrations + +import ( + "context" + "database/sql" + "github.com/pressly/goose/v3" +) + +func init() { + goose.AddMigrationContext(upRemoveDuplicate, downRemoveDuplicate) +} + +func upRemoveDuplicate(ctx context.Context, tx *sql.Tx) error { + // This code is executed when the migration is applied. + _, err := tx.Exec(` +alter table media_file + drop column is_duplicate; + +`) + return err +} + +func downRemoveDuplicate(ctx context.Context, tx *sql.Tx) error { + // This code is executed when the migration is rolled back. + return nil +}