-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDBScript.sql
More file actions
54 lines (47 loc) · 1.6 KB
/
Copy pathDBScript.sql
File metadata and controls
54 lines (47 loc) · 1.6 KB
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
create table customer
(
id int auto_increment,
email varchar(225) not null,
password varchar(32) not null,
username varchar(225) not null,
constraint Customer_email_uindex
unique (email),
constraint Customer_id_uindex
unique (id)
);
alter table customer
add primary key (id);
create table lot
(
id int auto_increment,
name varchar(45) not null,
description varchar(450) null,
start_price decimal(19, 4) not null,
create_time timestamp default CURRENT_TIMESTAMP not null,
is_active tinyint not null,
customer_id int not null,
constraint Lot_id_uindex
unique (id),
constraint lot_customer_id
foreign key (customer_id) references customer (id)
on delete cascade
);
alter table lot
add primary key (id);
create table lot_offer
(
id int auto_increment,
description varchar(450) null,
suggested_price decimal(19, 4) not null,
create_time timestamp default CURRENT_TIMESTAMP not null,
lot_id int not null,
customer_id int not null,
constraint LotOffer_id_uindex
unique (id),
constraint offer_customer_id
foreign key (customer_id) references customer (id),
constraint offer_lot_id
foreign key (lot_id) references lot (id)
);
alter table lot_offer
add primary key (id);