dashboard_snapshot_mig.go 880 B

123456789101112131415161718192021222324
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addDashboardSnapshotMigrations(mg *Migrator) {
  4. snapshotV4 := Table{
  5. Name: "dashboard_snapshot",
  6. Columns: []*Column{
  7. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  8. {Name: "name", Type: DB_NVarchar, Length: 255, Nullable: false},
  9. {Name: "key", Type: DB_NVarchar, Length: 255, Nullable: false},
  10. {Name: "dashboard", Type: DB_Text, Nullable: false},
  11. {Name: "expires", Type: DB_DateTime, Nullable: false},
  12. {Name: "created", Type: DB_DateTime, Nullable: false},
  13. {Name: "updated", Type: DB_DateTime, Nullable: false},
  14. },
  15. Indices: []*Index{
  16. {Cols: []string{"key"}, Type: UniqueIndex},
  17. },
  18. }
  19. mg.AddMigration("create dashboard_snapshot table v4", NewAddTableMigration(snapshotV4))
  20. addTableIndicesMigrations(mg, "v4", snapshotV4)
  21. }