-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.sql
72 lines (66 loc) · 3.38 KB
/
schema.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
DROP TABLE IF EXISTS contacts;
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS users_sessions;
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
email VARCHAR(50) NOT NULL UNIQUE,
password TEXT NOT NULL,
name VARCHAR(50) NOT NULL
);
CREATE TABLE users_sessions (
session_id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL
CONSTRAINT users_sessions_users_id_fk
REFERENCES users
ON UPDATE CASCADE ON DELETE CASCADE,
token TEXT NOT NULL,
expires_at INTEGER NOT NULL
);
CREATE TABLE contacts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
phone CHAR(15) NOT NULL UNIQUE,
email VARCHAR(100) NOT NULL UNIQUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
INSERT INTO contacts (first_name, last_name, phone, email) VALUES
('John', 'Doe', '1234567890', '[email protected]'),
('Jane', 'Smith', '2345678901', '[email protected]'),
('Michael', 'Brown', '3456789012', '[email protected]'),
('Emily', 'Davis', '4567890123', '[email protected]'),
('Matthew', 'Johnson', '5678901234', '[email protected]'),
('Olivia', 'Wilson', '6789012345', '[email protected]'),
('Daniel', 'Martinez', '7890123456', '[email protected]'),
('Sophia', 'Anderson', '8901234567', '[email protected]'),
('David', 'Taylor', '9012345678', '[email protected]'),
('Emma', 'Thomas', '0123456789', '[email protected]'),
('James', 'Moore', '1234509876', '[email protected]'),
('Ava', 'Jackson', '2345610987', '[email protected]'),
('William', 'White', '3456721098', '[email protected]'),
('Isabella', 'Harris', '4567832109', '[email protected]'),
('Alexander', 'Clark', '5678943210', '[email protected]'),
('Mia', 'Lewis', '6789054321', '[email protected]'),
('Ethan', 'Robinson', '7890165432', '[email protected]'),
('Charlotte', 'Walker', '8901276543', '[email protected]'),
('Benjamin', 'Young', '9012387654', '[email protected]'),
('Amelia', 'Hall', '0123498765', '[email protected]'),
('Liam', 'Scott', '1234678901', '[email protected]'),
('Lucas', 'King', '2345789012', '[email protected]'),
('Mason', 'Green', '3456890123', '[email protected]'),
('Harper', 'Baker', '4567901234', '[email protected]'),
('Ella', 'Nelson', '5678012345', '[email protected]'),
('Logan', 'Carter', '6789123456', '[email protected]'),
('Abigail', 'Mitchell', '7890234567', '[email protected]'),
('Elijah', 'Perez', '8901345678', '[email protected]'),
('Grace', 'Roberts', '9012456789', '[email protected]'),
('Henry', 'Turner', '0123567890', '[email protected]'),
('Avery', 'Phillips', '1234678902', '[email protected]'),
('Jackson', 'Campbell', '2345789013', '[email protected]'),
('Sebastian', 'Parker', '3456890124', '[email protected]'),
('Aria', 'Evans', '4567901235', '[email protected]'),
('Luke', 'Edwards', '5678012346', '[email protected]'),
('Zoe', 'Collins', '6789123457', '[email protected]'),
('Jack', 'Stewart', '7890234568', '[email protected]'),
('Riley', 'Sanchez', '8901345679', '[email protected]'),
('Samuel', 'Morris', '9012456780', '[email protected]');