Skip to content

Commit

Permalink
Add path to playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Jul 18, 2020
1 parent 3239be4 commit 35114be
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
27 changes: 27 additions & 0 deletions 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
}
2 changes: 2 additions & 0 deletions model/playlist.go
Expand Up @@ -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"`
}
Expand Down

0 comments on commit 35114be

Please sign in to comment.