-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
39 lines (33 loc) · 899 Bytes
/
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
CREATE TABLE Users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
phone TEXT NOT NULL,
email TEXT NOT NULL UNIQUE,
password TEXT NOT NULL
);
CREATE TABLE listings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
title TEXT NOT NULL,
description TEXT NOT NULL,
category TEXT NOT NULL,
price INTEGER NOT NULL,
date DATE,
FOREIGN KEY (user_id) REFERENCES Users(id)
);
Create TABLE requests (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
title TEXT NOT NULL,
description TEXT NOT NULL,
category TEXT NOT NULL,
price INTEGER NOT NULL,
date DATE,
FOREIGN KEY (user_id) REFERENCES Users(id)
);
-- table for images
CREATE TABLE images (
id INTEGER PRIMARY KEY AUTOINCREMENT,
listing_id INTEGER NOT NULL,
FOREIGN KEY (listing_id) REFERENCES listings(id)
);