temp_user.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. package migrations
  2. import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
  3. func addTempUserMigrations(mg *Migrator) {
  4. tempUserV1 := Table{
  5. Name: "temp_user",
  6. Columns: []*Column{
  7. {Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
  8. {Name: "org_id", Type: DB_BigInt, Nullable: false},
  9. {Name: "version", Type: DB_Int, Nullable: false},
  10. {Name: "email", Type: DB_NVarchar, Length: 255},
  11. {Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
  12. {Name: "role", Type: DB_NVarchar, Length: 20, Nullable: true},
  13. {Name: "code", Type: DB_NVarchar, Length: 255},
  14. {Name: "is_invite", Type: DB_Bool},
  15. {Name: "invited_by", Type: DB_NVarchar, Length: 255, Nullable: true},
  16. {Name: "email_sent", Type: DB_Bool},
  17. {Name: "email_sent_on", Type: DB_DateTime, Nullable: true},
  18. {Name: "created", Type: DB_DateTime},
  19. {Name: "updated", Type: DB_DateTime},
  20. },
  21. Indices: []*Index{
  22. {Cols: []string{"email"}, Type: IndexType},
  23. {Cols: []string{"org_id"}, Type: IndexType},
  24. {Cols: []string{"code"}, Type: IndexType},
  25. },
  26. }
  27. // create table
  28. mg.AddMigration("create temp user table v1", NewAddTableMigration(tempUserV1))
  29. addTableIndicesMigrations(mg, "v1-1", tempUserV1)
  30. }