-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
2,189 additions
and
18 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
CREATE TABLE games ( | ||
id integer NOT NULL PRIMARY KEY, | ||
name text NOT NULL, | ||
caption varchar, | ||
developer integer, | ||
image text, | ||
direcroty text, | ||
executive text, | ||
installed datetime NOT NULL, | ||
playtime integer NOT NULL | ||
); | ||
|
||
CREATE INDEX index_1 ON games (id); | ||
CREATE INDEX index_4 ON games (installed); | ||
|
||
CREATE TABLE tags ( | ||
id integer NOT NULL PRIMARY KEY, | ||
name text NOT NULL | ||
); | ||
|
||
CREATE INDEX index_1 ON tags (id); | ||
|
||
CREATE TABLE game_tags ( | ||
game_id integer NOT NULL PRIMARY KEY, | ||
tag_id integer NOT NULL PRIMARY KEY | ||
); | ||
|
||
|
||
CREATE TABLE genres ( | ||
id integer NOT NULL PRIMARY KEY, | ||
name text NOT NULL | ||
); | ||
|
||
|
||
CREATE TABLE game_genres ( | ||
game_id integer NOT NULL PRIMARY KEY, | ||
genre_id integer NOT NULL PRIMARY KEY | ||
); | ||
|
||
|
||
CREATE TABLE sessions ( | ||
id integer NOT NULL PRIMARY KEY, | ||
game_id integer NOT NULL, | ||
start_time datetime NOT NULL, | ||
end_time datetime, | ||
duration integer | ||
); | ||
|
||
|
||
CREATE TABLE developers ( | ||
id integer NOT NULL PRIMARY KEY, | ||
name text NOT NULL | ||
); | ||
|
||
|
||
ALTER TABLE games ADD CONSTRAINT games_id_fk FOREIGN KEY (id) REFERENCES game_tags (game_id); | ||
ALTER TABLE game_tags ADD CONSTRAINT game_tags_tag_id_fk FOREIGN KEY (tag_id) REFERENCES tags (id); | ||
ALTER TABLE games ADD CONSTRAINT games_id_fk FOREIGN KEY (id) REFERENCES game_genres (game_id); | ||
ALTER TABLE game_genres ADD CONSTRAINT game_genres_genre_id_fk FOREIGN KEY (genre_id) REFERENCES genres (id); | ||
ALTER TABLE games ADD CONSTRAINT games_id_fk FOREIGN KEY (id) REFERENCES sessions (game_id); | ||
ALTER TABLE games ADD CONSTRAINT games_developer_fk FOREIGN KEY (developer) REFERENCES developers (id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.