-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
50 lines (42 loc) · 876 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
38
39
40
41
42
43
44
45
46
47
48
49
50
CREATE DATABASE homechekr;
CREATE TABLE users(
id SERIAL PRIMARY KEY,
email VARCHAR(500),
password_digest VARCHAR(500),
profile_img TEXT
);
CREATE TABLE properties(
id SERIAL PRIMARY KEY,
date_added TIMESTAMP,
address TEXT,
street_number TEXT,
street_name TEXT,
suburb TEXT,
state TEXT,
postcode TEXT,
property_type TEXT,
sale_type TEXT,
listing_url TEXT,
storey_count INTEGER,
bed_count INTEGER,
bath_count INTEGER,
car_space_count INTEGER,
asking_price INTEGER,
sold_price INTEGER,
cooking TEXT,
aircon TEXT,
heating TEXT,
orientation TEXT,
notes_general TEXT,
main_img TEXT,
user_id INTEGER
);
CREATE TABLE comments(
id SERIAL PRIMARY KEY,
property_id INTEGER,
user_id INTEGER,
content TEXT
);
-- ALTER TABLE properties
-- ADD COLUMN address text;
SELECT * FROM properties WHERE address ILIKE '%nio%';