From 35114be5f741fe920ff438889710208c2ffe68e9 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 10 Jul 2020 21:44:40 -0400 Subject: [PATCH] Add path to playlist --- .../20200710211442_add_playlist_path.go | 27 +++++++++++++++++++ model/playlist.go | 2 ++ 2 files changed, 29 insertions(+) create mode 100644 db/migration/20200710211442_add_playlist_path.go diff --git a/db/migration/20200710211442_add_playlist_path.go b/db/migration/20200710211442_add_playlist_path.go new file mode 100644 index 00000000000..7249a325b33 --- /dev/null +++ b/db/migration/20200710211442_add_playlist_path.go @@ -0,0 +1,27 @@ +package migration + +import ( + "database/sql" + + "github.com/pressly/goose" +) + +func init() { + goose.AddMigration(upAddPlaylistPath, downAddPlaylistPath) +} + +func upAddPlaylistPath(tx *sql.Tx) error { + _, err := tx.Exec(` +alter table playlist + add path string default '' not null; + +alter table playlist + add sync bool default false not null; +`) + + return err +} + +func downAddPlaylistPath(tx *sql.Tx) error { + return nil +} diff --git a/model/playlist.go b/model/playlist.go index cd20da6320d..2931eac9580 100644 --- a/model/playlist.go +++ b/model/playlist.go @@ -13,6 +13,8 @@ type Playlist struct { Owner string `json:"owner"` Public bool `json:"public"` Tracks MediaFiles `json:"tracks,omitempty"` + Path string `json:"path"` + Sync bool `json:"sync"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }