forked from stadust/pointercrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20200813055728_dash_rs.up.sql
97 lines (85 loc) · 2.67 KB
/
20200813055728_dash_rs.up.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
-- Your SQL goes here
CREATE TABLE gj_creator (
user_id bigint PRIMARY KEY NOT NULL,
name text NOT NULL,
account_id bigint
);
CREATE TABLE gj_creator_meta (
user_id bigint PRIMARY KEY NOT NULL, -- No REFERENCES creator(user_id) as we also have to keep track of _missing_ entries here!
cached_at timestamp without time zone NOT NULL,
absent boolean DEFAULT false NOT NULL
);
CREATE TABLE gj_level (
level_id bigint PRIMARY KEY NOT NULL,
level_name text NOT NULL,
description text,
level_version integer NOT NULL,
creator_id bigint NOT NULL,
difficulty smallint NOT NULL,
is_demon boolean not null,
downloads integer NOT NULL,
main_song smallint,
gd_version smallint NOT NULL,
likes integer NOT NULL,
level_length smallint NOT NULL,
stars smallint NOT NULL,
featured integer NOT NULL,
copy_of bigint,
two_player boolean NOT NULL,
custom_song_id bigint,
coin_amount smallint NOT NULL,
coins_verified boolean NOT NULL,
stars_requested smallint,
is_epic boolean NOT NULL,
object_amount integer,
index_46 text,
index_47 text
);
CREATE TABLE gj_level_meta (
level_id bigint PRIMARY KEY NOT NULL,
cached_at timestamp without time zone NOT NULL,
absent boolean DEFAULT false NOT NULL
);
-- Many-to-many table mapping each level request to the list of levels it returned
CREATE TABLE gj_level_request_results (
level_id bigint NOT NULL,
request_hash bigint NOT NULL
);
CREATE TABLE gj_level_request_meta (
request_hash bigint PRIMARY KEY NOT NULL,
cached_at timestamp without time zone NOT NULL,
absent boolean DEFAULT false NOT NULL
);
CREATE TABLE gj_level_data (
level_id bigint PRIMARY KEY REFERENCES gj_level(level_id) NOT NULL,
level_data bytea NOT NULL,
level_password integer,
time_since_upload text NOT NULL,
time_since_update text NOT NULL,
index_36 text
);
CREATE TABLE gj_level_data_meta (
level_id bigint PRIMARY KEY NOT NULL,
cached_at timestamp without time zone NOT NULL,
absent boolean DEFAULT false NOT NULL
);
CREATE TABLE gj_newgrounds_song (
song_id bigint PRIMARY KEY NOT NULL,
song_name text NOT NULL,
index_3 bigint NOT NULL,
song_artist text NOT NULL,
filesize double precision NOT NULL,
index_6 text,
index_7 text,
index_8 text NOT NULL,
song_link text NOT NULL
);
CREATE TABLE gj_newgrounds_song_meta (
song_id bigint PRIMARY KEY NOT NULL,
cached_at timestamp without time zone NOT NULL,
absent boolean DEFAULT false NOT NULL
);
CREATE TABLE download_lock(
level_id bigint not null
);
ALTER TABLE demons ADD COLUMN level_id INT8 NULL UNIQUE REFERENCES gj_level(level_id);