From 300a0292ba4af528cfa7eb40591b695f1b9a6b4b Mon Sep 17 00:00:00 2001 From: Deluan Date: Mon, 22 Mar 2021 13:38:20 -0400 Subject: [PATCH] Add timestamp indexes --- .../20210322132848_add_timestamp_indexes.go | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 db/migration/20210322132848_add_timestamp_indexes.go diff --git a/db/migration/20210322132848_add_timestamp_indexes.go b/db/migration/20210322132848_add_timestamp_indexes.go new file mode 100644 index 000000000..d6d33dc9f --- /dev/null +++ b/db/migration/20210322132848_add_timestamp_indexes.go @@ -0,0 +1,33 @@ +package migrations + +import ( + "database/sql" + + "github.com/pressly/goose" +) + +func init() { + goose.AddMigration(upAddTimestampIndexesGo, downAddTimestampIndexesGo) +} + +func upAddTimestampIndexesGo(tx *sql.Tx) error { + _, err := tx.Exec(` +create index if not exists album_updated_at + on album (updated_at); +create index if not exists album_created_at + on album (created_at); +create index if not exists playlist_updated_at + on playlist (updated_at); +create index if not exists playlist_created_at + on playlist (created_at); +create index if not exists media_file_created_at + on media_file (created_at); +create index if not exists media_file_updated_at + on media_file (updated_at); +`) + return err +} + +func downAddTimestampIndexesGo(tx *sql.Tx) error { + return nil +}