mirror of
https://github.com/grafana/grafana.git
synced 2026-08-14 07:04:57 -05:00
feat(invite): worked on db & domain model for temp users, #2353
This commit is contained in:
@@ -10,6 +10,7 @@ import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
func AddMigrations(mg *Migrator) {
|
||||
addMigrationLogMigrations(mg)
|
||||
addUserMigrations(mg)
|
||||
addTempUserMigrations(mg)
|
||||
addStarMigrations(mg)
|
||||
addOrgMigrations(mg)
|
||||
addDashboardMigration(mg)
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package migrations
|
||||
|
||||
import . "github.com/grafana/grafana/pkg/services/sqlstore/migrator"
|
||||
|
||||
func addTempUserMigrations(mg *Migrator) {
|
||||
tempUserV1 := Table{
|
||||
Name: "temp_user",
|
||||
Columns: []*Column{
|
||||
{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
|
||||
{Name: "org_id", Type: DB_BigInt, Nullable: false},
|
||||
{Name: "version", Type: DB_Int, Nullable: false},
|
||||
{Name: "email", Type: DB_NVarchar, Length: 255},
|
||||
{Name: "name", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "role", Type: DB_NVarchar, Length: 20, Nullable: true},
|
||||
{Name: "code", Type: DB_NVarchar, Length: 255},
|
||||
{Name: "is_invite", Type: DB_Bool},
|
||||
{Name: "invited_by", Type: DB_NVarchar, Length: 255, Nullable: true},
|
||||
{Name: "email_sent", Type: DB_Bool},
|
||||
{Name: "email_sent_on", Type: DB_DateTime, Nullable: true},
|
||||
{Name: "created", Type: DB_DateTime},
|
||||
{Name: "updated", Type: DB_DateTime},
|
||||
},
|
||||
Indices: []*Index{
|
||||
{Cols: []string{"email"}, Type: IndexType},
|
||||
{Cols: []string{"org_id"}, Type: IndexType},
|
||||
{Cols: []string{"code"}, Type: IndexType},
|
||||
},
|
||||
}
|
||||
|
||||
// create table
|
||||
mg.AddMigration("create temp user table v1", NewAddTableMigration(tempUserV1))
|
||||
|
||||
addTableIndicesMigrations(mg, "v1-1", tempUserV1)
|
||||
}
|
||||
Reference in New Issue
Block a user