-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.sql
More file actions
47 lines (30 loc) · 913 Bytes
/
Copy pathdatabase.sql
File metadata and controls
47 lines (30 loc) · 913 Bytes
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
CREATE TABLE "users" (
"id" serial PRIMARY KEY NOT NULL,
"username" varchar(32) NOT NULL UNIQUE,
"password" varchar(32) NOT NULL,
"email" varchar(255) NOT NULL,
"access_level" int NOT NULL DEFAULT '1'
);
CREATE TABLE "fish_list" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"description" TEXT NOT NULL,
"image_url" TEXT NOT NULL
);
CREATE TABLE "lure_list" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(255) NOT NULL,
"description" serial NOT NULL,
"image_url" serial NOT NULL
);
CREATE TABLE "journal" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" int NOT NULL REFERENCES "users" ON DELETE CASCADE,
"fish_id" int NOT NULL REFERENCES "fish_list" ON DELETE CASCADE,
"lure_id" int NOT NULL REFERENCES "lure_list" ON DELETE CASCADE,
"date" DATE NOT NULL,
"fish_image_url" TEXT,
"weight" numeric NOT NULL,
"length" numeric NOT NULL,
"comments" TEXT
);