tcl-guessr/migrations/0002_add_scores_tables.sql

19 lines
554 B
SQL

-- 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)
);