-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
48 lines (43 loc) · 1.92 KB
/
db.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
pragma foreignkeys=on;
create table users( user int primary key,
email email not null unique,
password password not null,
firstName text,
lastName text);
create table households( household int primary key,
name text,
street text,
city text);
create table members( user int,
household int,
primary key (user, household),
foreign key (user) references users(user),
foreign key (household) references households(household));
create table groceries( id primary key,
household int,
user int,
item text,
foreign key (household) references households(household),
foreign key (user) references users(user)
);
create table chores( id int primary key,
household int,
user int,
task text,
date date,
foreign key (household) references households(household),
foreign key (user) references users(user));
create table rental(household int,
user int,
rent int,
dueDate integer,
primary key(household, user));
create table payments( household int,
user int,
due date,
paid boolean);
create table landlords( household int,
user int,
primary key(household, user),
foreign key (household) references households(household),
foreign key (user) references users(user));