Skip to content

🎧 Your Personal Streaming Service

Add path to playlist

Deluan35114be5f741
diff --git a/db/migration/20200710211442_add_playlist_path.go b/db/migration/20200710211442_add_playlist_path.go
new file mode 100644
index 000000000..7249a325b
--- /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 cd20da632..2931eac95 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"`
}