-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathuser.sql
More file actions
24 lines (21 loc) · 842 Bytes
/
user.sql
File metadata and controls
24 lines (21 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS `GovUser`;
CREATE TABLE `GovUser` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`ccNumber` varchar(255) NOT NULL,
`registerDate` datetime NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `UserId_UNIQUE` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `UserGovUser`;
CREATE TABLE `UserGovUser` (
`UserId` int(11) NOT NULL,
`GovUserId` int(11) NOT NULL,
PRIMARY KEY (`UserId`,`GovUserId`),
UNIQUE KEY `UserGovUser` (`UserId`,`GovUserId`),
KEY `UGUserId_idx` (`UserId`),
CONSTRAINT `UGUserId_fk` FOREIGN KEY (`UserId`) REFERENCES `User` (`UserId`) ON DELETE CASCADE,
CONSTRAINT `UGUGovUserId_fk` FOREIGN KEY (`GovUserId`) REFERENCES `GovUser` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET FOREIGN_KEY_CHECKS = 1;