-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sql
33 lines (27 loc) · 805 Bytes
/
setup.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
DROP TABLE IF EXISTS signatures;
DROP TABLE IF EXISTS user_profiles;
DROP TABLE IF EXISTS users;
CREATE TABLE users(
id SERIAL PRIMARY KEY,
first VARCHAR(255) NOT NULL,
last VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE user_profiles (
id SERIAL PRIMARY KEY,
age INTEGER NULL,
url VARCHAR(255) NULL,
city VARCHAR(255) NULL,
user_id INTEGER NOT NULL UNIQUE
);
CREATE TABLE signatures (
id SERIAL PRIMARY KEY,
signature TEXT NOT NULL,
user_id INTEGER NOT NULL UNIQUE REFERENCES users(id),
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
SELECT * FROM users;
SELECT * FROM user_profiles;
SELECT * FROM signatures;