-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
22 lines (21 loc) · 776 Bytes
/
database.sql
File metadata and controls
22 lines (21 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
CREATE TABLE IF NOT EXISTS users (
id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
password varchar(255) NOT NULL,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP(),
updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP(),
PRIMARY KEY(id),
UNIQUE KEY(name)
);
CREATE TABLE IF NOT EXISTS contacts (
id bigint(20) NOT NULL AUTO_INCREMENT,
name varchar(255) NOT NULL,
surname varchar(255) NOT NULL,
email varchar(255) NOT NULL,
message varchar(255) NOT NULL,
created_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP(),
updated_at datetime NOT NULL DEFAULT CURRENT_TIMESTAMP(),
user_id bigint(20) unsigned NOT NULL,
PRIMARY KEY(id),
FOREIGN KEY(user_id) REFERENCES users(id)
);