Skip to content

Commit af196c0

Browse files
committed
update db dump
1 parent ff9bf3d commit af196c0

File tree

1 file changed

+214
-31
lines changed

1 file changed

+214
-31
lines changed

db/dump.sql

Lines changed: 214 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,247 @@
11
create database tracker
22
with owner postgres;
33

4-
create table groups
4+
create table blogposts
55
(
6-
id varchar(26) not null
7-
constraint groups_pk
6+
id char(26) not null
7+
constraint blogposts_pk
88
primary key,
9-
artist varchar not null,
10-
album varchar not null,
11-
original_release_year integer not null
9+
title varchar not null,
10+
content varchar not null,
11+
timestamp timestamp not null
1212
);
1313

14-
alter table groups owner to postgres;
14+
alter table blogposts owner to postgres;
15+
16+
create table users
17+
(
18+
id char(26) not null
19+
constraint users_pk
20+
primary key,
21+
username varchar not null,
22+
password_hash varchar(60) not null,
23+
email varchar(255) not null,
24+
activated boolean not null
25+
);
26+
27+
alter table users owner to postgres;
1528

1629
create table torrents
1730
(
1831
id varchar(26) not null
1932
constraint torrents_pk
2033
primary key,
21-
group_id varchar(26) not null
22-
constraint torrents_groups_id_fk
23-
references groups,
2434
file_size integer not null,
2535
original_file_name varchar not null,
2636
file_path varchar not null,
2737
files jsonb,
28-
release_type varchar not null,
29-
format varchar not null,
30-
bitrate integer not null,
31-
media varchar not null
38+
uploader_id char(26) not null
39+
constraint torrents_users_id_fk
40+
references users
3241
);
3342

3443
alter table torrents owner to postgres;
3544

36-
create table blogposts
45+
create unique index users_id_uindex
46+
on users (id);
47+
48+
create table activation_codes
3749
(
38-
id varchar(26) not null
39-
constraint blogposts_pk
50+
id char(26),
51+
user_id char(26) not null
52+
constraint activation_codes_users_id_fk
53+
references users,
54+
activation_code varchar(64) not null
55+
);
56+
57+
alter table activation_codes owner to postgres;
58+
59+
create table video_qualities
60+
(
61+
id char(26) not null
62+
constraint video_qualities_pk
63+
primary key,
64+
quality varchar not null
65+
);
66+
67+
alter table video_qualities owner to postgres;
68+
69+
create table video_releases
70+
(
71+
id char(26) not null
72+
constraint video_releases_pk
4073
primary key,
74+
video_id char(26) not null,
75+
torrent_id char(26) not null
76+
constraint video_releases_torrents_id_fk
77+
references torrents,
78+
quality char(26)
79+
constraint video_releases_video_qualities_id_fk
80+
references video_qualities,
4181
title varchar not null,
42-
content varchar not null,
43-
timestamp timestamp not null
82+
description varchar
4483
);
4584

46-
alter table blogposts owner to postgres;
85+
alter table video_releases owner to postgres;
4786

48-
create table users
87+
create unique index video_releases_torrent_id_uindex
88+
on video_releases (torrent_id);
89+
90+
create unique index video_qualities_quality_uindex
91+
on video_qualities (quality);
92+
93+
create table movies
4994
(
50-
id varchar(26) not null
51-
constraint users_pk
95+
id char(26) not null
96+
constraint movies_pk
5297
primary key,
53-
username varchar not null,
54-
password_hash varchar not null,
55-
email varchar not null,
56-
activation_code varchar,
57-
activated boolean not null
98+
name varchar not null,
99+
description varchar not null,
100+
year integer not null
58101
);
59102

60-
alter table users owner to postgres;
103+
alter table movies owner to postgres;
61104

62-
create unique index users_id_uindex
63-
on users (id);
105+
create table tv_shows
106+
(
107+
id char(26) not null
108+
constraint tv_shows_pk
109+
primary key,
110+
name varchar not null,
111+
season integer,
112+
description varchar
113+
);
114+
115+
alter table tv_shows owner to postgres;
116+
117+
create table anime
118+
(
119+
id char(26) not null
120+
constraint anime_pk
121+
primary key,
122+
name varchar not null,
123+
season integer,
124+
description varchar
125+
);
126+
127+
alter table anime owner to postgres;
128+
129+
create table games
130+
(
131+
id char(26) not null
132+
constraint games_pk
133+
primary key,
134+
name varchar not null,
135+
operating_system varchar,
136+
description varchar,
137+
torrent_id char(26) not null
138+
constraint games_torrents_id_fk
139+
references torrents
140+
);
141+
142+
alter table games owner to postgres;
143+
144+
create unique index games_torrent_id_uindex
145+
on games (torrent_id);
146+
147+
create table software
148+
(
149+
id char(26) not null
150+
constraint software_pk
151+
primary key,
152+
name varchar not null,
153+
operating_system varchar,
154+
description varchar,
155+
torrent_id char(26) not null
156+
constraint software_torrents_id_fk
157+
references torrents
158+
);
159+
160+
alter table software owner to postgres;
161+
162+
create table music_qualities
163+
(
164+
id char(26) not null
165+
constraint music_qualities_pk
166+
primary key,
167+
quality varchar not null
168+
);
169+
170+
alter table music_qualities owner to postgres;
171+
172+
create unique index music_qualities_quality_uindex
173+
on music_qualities (quality);
174+
175+
create table artists
176+
(
177+
id char(26) not null
178+
constraint artists_pk
179+
primary key,
180+
name varchar not null,
181+
description varchar
182+
);
183+
184+
alter table artists owner to postgres;
185+
186+
create table music
187+
(
188+
id char(26) not null
189+
constraint music_pk
190+
primary key,
191+
title varchar not null,
192+
year integer not null,
193+
description varchar,
194+
music_release_id char(26) not null
195+
);
196+
197+
alter table music owner to postgres;
198+
199+
create table music_releases
200+
(
201+
id char(26) not null
202+
constraint music_releases_pk
203+
primary key,
204+
encoding varchar,
205+
quality char(26) not null
206+
constraint music_releases_music_qualities_id_fk
207+
references music_qualities,
208+
music_id char(26) not null
209+
constraint music_releases_music_id_fk
210+
references music,
211+
torrent_id char(26) not null
212+
constraint music_releases_torrents_id_fk
213+
references torrents,
214+
title varchar not null,
215+
description varchar
216+
);
217+
218+
alter table music_releases owner to postgres;
219+
220+
create table music_artists
221+
(
222+
music_id char(26) not null
223+
constraint music_artists_music_id_fk
224+
references music,
225+
artist_id char(26) not null
226+
constraint music_artists_artists_id_fk
227+
references artists,
228+
is_primary boolean not null,
229+
constraint music_artists_pk
230+
primary key (music_id, artist_id)
231+
);
232+
233+
alter table music_artists owner to postgres;
234+
235+
create table music_release_types
236+
(
237+
id char(26) not null
238+
constraint music_release_types_pk
239+
primary key,
240+
release_type varchar not null
241+
);
242+
243+
alter table music_release_types owner to postgres;
244+
245+
create unique index music_release_types_release_type_uindex
246+
on music_release_types (release_type);
64247

0 commit comments

Comments
 (0)