diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-29 23:52:37 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-30 00:26:09 +0900 |
| commit | b7e2d4571b61f20a9f4a288f41ba0a30e488eda4 (patch) | |
| tree | 71cb6be06a126fb2683c377e16ac0ef5c5af2d31 | |
| parent | 7e2704c90ffba3612bd87ed342d4f310b0de78c0 (diff) | |
| download | phperkaigi-2025-albatross-b7e2d4571b61f20a9f4a288f41ba0a30e488eda4.tar.gz phperkaigi-2025-albatross-b7e2d4571b61f20a9f4a288f41ba0a30e488eda4.tar.zst phperkaigi-2025-albatross-b7e2d4571b61f20a9f4a288f41ba0a30e488eda4.zip | |
feat(backend): add fixture file for local dev
| -rw-r--r-- | backend/fixtures/dev.sql | 37 | ||||
| -rw-r--r-- | backend/schema.sql | 12 |
2 files changed, 43 insertions, 6 deletions
diff --git a/backend/fixtures/dev.sql b/backend/fixtures/dev.sql new file mode 100644 index 0000000..3549d86 --- /dev/null +++ b/backend/fixtures/dev.sql @@ -0,0 +1,37 @@ +INSERT INTO users +(username, display_name, icon_path, is_admin) +VALUES + ('a', 'TEST A', NULL, FALSE), + ('b', 'TEST B', NULL, FALSE), + ('c', 'TEST C', NULL, TRUE); + +INSERT INTO user_auths +(user_id, auth_type) +VALUES + (1, 'bypass'), + (2, 'bypass'), + (3, 'bypass'); + +INSERT INTO problems +(title, description) +VALUES + ('TEST problem 1', 'This is TEST problem 1'), + ('TEST problem 2', 'This is TEST problem 2'), + ('TEST problem 3', 'This is TEST problem 3'); + +INSERT INTO games +(state, display_name, duration_seconds, problem_id) +VALUES + ('waiting_entries', 'TEST game 1', 180, 1), + ('closed', 'TEST game 2', 180, 2), + ('finished', 'TEST game 3', 180, 3); + +INSERT INTO game_players +(game_id, user_id) +VALUES + (1, 1), + (1, 2), + (2, 1), + (2, 2), + (3, 1), + (3, 2); diff --git a/backend/schema.sql b/backend/schema.sql index 7f98d91..2a92271 100644 --- a/backend/schema.sql +++ b/backend/schema.sql @@ -15,6 +15,12 @@ CREATE TABLE user_auths ( CONSTRAINT fk_user_id FOREIGN KEY(user_id) REFERENCES users(user_id) ); +CREATE TABLE problems ( + problem_id SERIAL PRIMARY KEY, + title VARCHAR(255) NOT NULL, + description TEXT NOT NULL +); + CREATE TABLE games ( game_id SERIAL PRIMARY KEY, state VARCHAR(32) NOT NULL, @@ -34,12 +40,6 @@ CREATE TABLE game_players ( CONSTRAINT fk_user_id FOREIGN KEY(user_id) REFERENCES users(user_id) ); -CREATE TABLE problems ( - problem_id SERIAL PRIMARY KEY, - title VARCHAR(255) NOT NULL, - description TEXT NOT NULL -); - CREATE TABLE testcases ( testcase_id SERIAL PRIMARY KEY, problem_id INT NOT NULL, |
