preferences_mig.go 1.0 KB

123456789101112131415161718192021222324252627282930
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addPreferencesMigrations(mg *Migrator) {
  4. mg.AddMigration("drop preferences table v2", NewDropTableMigration("preferences"))
  5. preferencesV2 := Table{
  6. Name: "preferences",
  7. Columns: []*Column{
  8. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  9. {Name: "org_id", Type: DB_Int, Nullable: true},
  10. {Name: "user_id", Type: DB_NVarchar, Length: 255, Nullable: true},
  11. {Name: "version", Type: DB_Int, Nullable: false},
  12. {Name: "home_dashboard_id", Type: DB_BigInt, Nullable: true},
  13. {Name: "timezone", Type: DB_NVarchar, Length: 50, Nullable: true},
  14. {Name: "theme", Type: DB_NVarchar, Length: 20, Nullable: true},
  15. {Name: "created", Type: DB_DateTime, Nullable: false},
  16. {Name: "updated", Type: DB_DateTime, Nullable: false},
  17. },
  18. Indices: []*Index{
  19. {Cols: []string{"org_id"}},
  20. {Cols: []string{"user_id"}},
  21. },
  22. }
  23. // create table
  24. mg.AddMigration("create preferences table v2", NewAddTableMigration(preferencesV2))
  25. }