Skip to content
Snippets Groups Projects
Commit f36bb388 authored by Christian Pointner's avatar Christian Pointner
Browse files

added playout-mode to playlist

parent 4f52c260
No related branches found
No related tags found
No related merge requests found
...@@ -144,6 +144,36 @@ var ( ...@@ -144,6 +144,36 @@ var (
return nil return nil
}, },
}, },
{
ID: "201908110945",
Migrate: func(tx *gorm.DB) error {
type PlaylistEntry struct {
ID uint64 `json:"-" gorm:"primary_key"`
PlaylistID uint64 `json:"-" gorm:"not null;index;unique_index:unique_playlist_line_numbers"`
LineNum uint `json:"-" gorm:"not null;unique_index:unique_playlist_line_numbers"`
URI string `json:"uri" gorm:"size:1024"`
File *File `json:"file,omitempty" gorm:"association_autoupdate:false;association_autocreate:false"`
FileID *uint64 `json:"-" gorm:"index"`
}
type Playlist struct {
ID uint64 `json:"id" gorm:"primary_key"`
CreatedAt time.Time `json:"created"`
UpdatedAt time.Time `json:"updated"`
Description string `json:"description"`
PlayoutMode string `json:"playout-mode"`
ShowName string `json:"show" gorm:"not null;index"`
Show Show `json:"-" gorm:"association_foreignkey:Name"`
Entries []PlaylistEntry `json:"entries,omitempty"`
}
return tx.AutoMigrate(&Playlist{}).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Table("playlists").DropColumn("playout_mode").Error
},
},
} }
) )
......
...@@ -210,6 +210,7 @@ type Playlist struct { ...@@ -210,6 +210,7 @@ type Playlist struct {
CreatedAt time.Time `json:"created"` CreatedAt time.Time `json:"created"`
UpdatedAt time.Time `json:"updated"` UpdatedAt time.Time `json:"updated"`
Description string `json:"description"` Description string `json:"description"`
PlayoutMode string `json:"playout-mode" gorm:"not null;default:'linear'"`
ShowName string `json:"show" gorm:"not null;index"` ShowName string `json:"show" gorm:"not null;index"`
Show Show `json:"-" gorm:"association_foreignkey:Name"` Show Show `json:"-" gorm:"association_foreignkey:Name"`
Entries []PlaylistEntry `json:"entries,omitempty"` Entries []PlaylistEntry `json:"entries,omitempty"`
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment