-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.sql
56 lines (48 loc) · 1.5 KB
/
create.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
create table Account (
id bigint not null auto_increment,
createdDate datetime,
updatedDate datetime,
dateOfBirth date,
firstName varchar(255),
lastName varchar(255),
userId bigint,
primary key (id)
) engine=InnoDB;
create table User (
id bigint not null auto_increment,
createdDate datetime,
updatedDate datetime,
password varchar(255) not null,
username varchar(255) not null,
primary key (id)
) engine=InnoDB;
alter table User
add constraint UK_jreodf78a7pl5qidfh43axdfb unique (username);
alter table Account
add constraint FK1txqu3l736h1mvpadcktj7js6
foreign key (userId)
references User (id);
create table Account (
id bigint not null auto_increment,
createdDate datetime,
updatedDate datetime,
dateOfBirth date,
firstName varchar(255),
lastName varchar(255),
userId bigint,
primary key (id)
) engine=InnoDB;
create table User (
id bigint not null auto_increment,
createdDate datetime,
updatedDate datetime,
password varchar(255) not null,
username varchar(255) not null,
primary key (id)
) engine=InnoDB;
alter table User
add constraint UK_jreodf78a7pl5qidfh43axdfb unique (username);
alter table Account
add constraint FK1txqu3l736h1mvpadcktj7js6
foreign key (userId)
references User (id);