playlist_mig.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addPlaylistMigrations(mg *Migrator) {
  4. mg.AddMigration("Drop old table playlist table", NewDropTableMigration("playlist"))
  5. mg.AddMigration("Drop old table playlist_item table", NewDropTableMigration("playlist_item"))
  6. playlistV2 := Table{
  7. Name: "playlist",
  8. Columns: []*Column{
  9. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  10. {Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
  11. {Name: "interval", Type: DB_NVarchar, Length: 255, Nullable: false},
  12. {Name: "org_id", Type: DB_BigInt, Nullable: false},
  13. },
  14. }
  15. // create table
  16. mg.AddMigration("create playlist table v2", NewAddTableMigration(playlistV2))
  17. playlistItemV2 := Table{
  18. Name: "playlist_item",
  19. Columns: []*Column{
  20. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  21. {Name: "playlist_id", Type: DB_BigInt, Nullable: false},
  22. {Name: "type", Type: DB_NVarchar, Length: 255, Nullable: false},
  23. {Name: "value", Type: DB_Text, Nullable: false},
  24. {Name: "title", Type: DB_Text, Nullable: false},
  25. {Name: "order", Type: DB_Int, Nullable: false},
  26. },
  27. }
  28. mg.AddMigration("create playlist item table v2", NewAddTableMigration(playlistItemV2))
  29. }