initial migration
All checks were successful
Build and Push Docker Image / build (push) Successful in 29s
All checks were successful
Build and Push Docker Image / build (push) Successful in 29s
This commit is contained in:
parent
91d96d1bcb
commit
07cf930328
42
migrations/models/0_20241211195324_init.py
Normal file
42
migrations/models/0_20241211195324_init.py
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
from tortoise import BaseDBAsyncClient
|
||||||
|
|
||||||
|
|
||||||
|
async def upgrade(db: BaseDBAsyncClient) -> str:
|
||||||
|
return """
|
||||||
|
CREATE TABLE IF NOT EXISTS "players" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"username" VARCHAR(20) NOT NULL UNIQUE,
|
||||||
|
"last_connection" TIMESTAMP,
|
||||||
|
"last_disconnection" TIMESTAMP,
|
||||||
|
"play_time_seconds" INT NOT NULL DEFAULT 0,
|
||||||
|
"is_dead" INT NOT NULL DEFAULT 0
|
||||||
|
) /* */;
|
||||||
|
CREATE TABLE IF NOT EXISTS "player_deaths" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"coordinate_x" INT NOT NULL,
|
||||||
|
"coordinate_y" INT NOT NULL,
|
||||||
|
"coordinate_z" INT NOT NULL,
|
||||||
|
"cause" VARCHAR(32) NOT NULL,
|
||||||
|
"timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS "steam_profile_summary" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"steam_id" VARCHAR(20) NOT NULL UNIQUE,
|
||||||
|
"profile_name" VARCHAR(32) NOT NULL,
|
||||||
|
"url" VARCHAR(128) NOT NULL,
|
||||||
|
"avatar_url" VARCHAR(128) NOT NULL,
|
||||||
|
"last_update" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS "aerich" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"version" VARCHAR(255) NOT NULL,
|
||||||
|
"app" VARCHAR(100) NOT NULL,
|
||||||
|
"content" JSON NOT NULL
|
||||||
|
);"""
|
||||||
|
|
||||||
|
|
||||||
|
async def downgrade(db: BaseDBAsyncClient) -> str:
|
||||||
|
return """
|
||||||
|
"""
|
Reference in New Issue
Block a user