generated from ger619/ruby-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathschema.sql
More file actions
59 lines (52 loc) · 1.22 KB
/
schema.sql
File metadata and controls
59 lines (52 loc) · 1.22 KB
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
-- Create a item class table
CREATE TABLE item (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
genre TEXT,
author TEXT,
label TEXT,
publish_date DATE,
archived BOOLEAN,
);
-- Create a book class table
CREATE TABLE book (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
item_id INT FOREIGN KEY REFERENCES item(id),
publisher TEXT,
cover_state TEXT,
);
-- Create a label class table
CREATE TABLE label (
id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
item_id INT FOREIGN KEY REFERENCES item(id),
title TEXT,
color TEXT
);
-- Create a game class table
CREATE TABLE game (
id SERIAL PRIMARY KEY ,
item_id INT FOREIGN KEY REFERENCES item(id),
multiplayer VARCHAR,
last_played_at DATE,
publish_date DATE,
);
-- Create a author class table
CREATE TABLE author (
id SERIAL PRIMARY KEY,
item_id INT FOREIGN KEY REFERENCES item(id),
first_name VARCHAR,
last_name VARCHAR
);
-- Create a Music Album class table
CREATE TABLE music_album (
id SERIAL PRIMARY KEY,
item_id INT FOREIGN KEY REFERENCES item(id),
on_spotify BOOLEAN,
publish_date DATE,
archived BOOLEAN,
);
-- create a genre
CREATE TABLE genre (
id SERIAL PRIMARY KEY,
item_id INT FOREIGN KEY REFERENCES item(id),
name VARCHAR
);