-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySQLIdentity.sql
40 lines (36 loc) · 1.2 KB
/
MySQLIdentity.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
CREATE TABLE `<DATABASENAME>`.`users` (
`Id` VARCHAR(45) NOT NULL,
`UserName` VARCHAR(45) NULL,
`PasswordHash` VARCHAR(100) NULL,
`SecurityStamp` VARCHAR(45) NULL,
PRIMARY KEY (`id`));
CREATE TABLE `<DATABASENAME>`.`roles` (
`Id` VARCHAR(45) NOT NULL,
`Name` VARCHAR(45) NULL,
PRIMARY KEY (`Id`));
CREATE TABLE `<DATABASENAME>`.`userclaims` (
`Id` INT NOT NULL AUTO_INCREMENT,
`UserId` VARCHAR(45) NULL,
`ClaimType` VARCHAR(100) NULL,
`ClaimValue` VARCHAR(100) NULL,
PRIMARY KEY (`Id`),
FOREIGN KEY (`UserId`)
REFERENCES `<DATABASENAME>`.`users` (`Id`) on delete cascade);
CREATE TABLE `<DATABASENAME>`.`userlogins` (
`UserId` VARCHAR(45) NOT NULL,
`ProviderKey` VARCHAR(100) NULL,
`LoginProvider` VARCHAR(100) NULL,
FOREIGN KEY (`UserId`)
REFERENCES `<DATABASENAME>`.`users` (`Id`) on delete cascade);
CREATE TABLE `<DATABASENAME>`.`userroles` (
`UserId` VARCHAR(45) NOT NULL,
`RoleId` VARCHAR(45) NOT NULL,
PRIMARY KEY (`UserId`, `RoleId`),
FOREIGN KEY (`UserId`)
REFERENCES `<DATABASENAME>`.`users` (`Id`)
on delete cascade
on update cascade,
FOREIGN KEY (`RoleId`)
REFERENCES `<DATABASENAME>`.`roles` (`Id`)
on delete cascade
on update cascade);