user_auth_mig.go 778 B

123456789101112131415161718192021222324
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addUserAuthMigrations(mg *Migrator) {
  4. userAuthV1 := Table{
  5. Name: "user_auth",
  6. Columns: []*Column{
  7. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  8. {Name: "user_id", Type: DB_BigInt, Nullable: false},
  9. {Name: "auth_module", Type: DB_NVarchar, Length: 190, Nullable: false},
  10. {Name: "auth_id", Type: DB_NVarchar, Length: 100, Nullable: false},
  11. {Name: "created", Type: DB_DateTime, Nullable: false},
  12. },
  13. Indices: []*Index{
  14. {Cols: []string{"auth_module", "auth_id"}},
  15. },
  16. }
  17. // create table
  18. mg.AddMigration("create user auth table", NewAddTableMigration(userAuthV1))
  19. // add indices
  20. addTableIndicesMigrations(mg, "v1", userAuthV1)
  21. }