feat: use d1 for game storage
This commit is contained in:
parent
ee5ed04bcb
commit
5423802ae5
11 changed files with 133 additions and 96 deletions
19
migrations/0002_add_scores_tables.sql
Normal file
19
migrations/0002_add_scores_tables.sql
Normal file
|
@ -0,0 +1,19 @@
|
|||
-- Migration number: 0002 2024-11-21T10:59:43.394Z
|
||||
CREATE TABLE game (
|
||||
`id` TEXT PRIMARY KEY, -- uuid
|
||||
`user_id` TEXT NOT NULL,
|
||||
`mode` TEXT NOT NULL,
|
||||
`time` INTEGER NOT NULL,
|
||||
`total_score` INTEGER NOT NULL,
|
||||
FOREIGN KEY(user_id) REFERENCES user(id)
|
||||
);
|
||||
|
||||
create table round (
|
||||
`id` INTEGER PRIMARY KEY ASC, -- rowid alias, should be automatically assigned
|
||||
`game_id` TEXT NOT NULL,
|
||||
`points` INTEGER NOT NULL,
|
||||
`distance` INTEGER NOT NULL,
|
||||
`stop_name` TEXT NOT NULL,
|
||||
FOREIGN KEY(game_id) REFERENCES game(id)
|
||||
);
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue