quota_mig.go 823 B

123456789101112131415161718192021222324252627
  1. package migrations
  2. import (
  3. . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  4. )
  5. func addQuotaMigration(mg *Migrator) {
  6. var quotaV1 = Table{
  7. Name: "quota",
  8. Columns: []*Column{
  9. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  10. {Name: "org_id", Type: DB_BigInt, Nullable: false},
  11. {Name: "target", Type: DB_NVarchar, Length: 255, Nullable: false},
  12. {Name: "limit", Type: DB_BigInt, Nullable: false},
  13. {Name: "created", Type: DB_DateTime, Nullable: false},
  14. {Name: "updated", Type: DB_DateTime, Nullable: false},
  15. },
  16. Indices: []*Index{
  17. {Cols: []string{"org_id", "target"}, Type: UniqueIndex},
  18. },
  19. }
  20. mg.AddMigration("create quota table v1", NewAddTableMigration(quotaV1))
  21. //------- indexes ------------------
  22. addTableIndicesMigrations(mg, "v1", quotaV1)
  23. }