remove that stupid package aerich, it's terrible!
This commit is contained in:
parent
55304170b1
commit
825843ed86
@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Debug environment variable flag.
|
- Debug environment variable flag.
|
||||||
- Command to build player data from existing log files.
|
- Command to build player data from existing log files.
|
||||||
- Database migration management with the aerich package.
|
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -13,4 +13,4 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|||||||
|
|
||||||
COPY . /app/
|
COPY . /app/
|
||||||
|
|
||||||
CMD ["sh", "-c", "aerich upgrade && python bot.py"]
|
CMD ["python", "bot.py"]
|
2
bot.py
2
bot.py
@ -25,7 +25,7 @@ TORTOISE_ORM = {
|
|||||||
"connections": { "default": f"sqlite://{str(DATA_DIR)}/db.sqlite" },
|
"connections": { "default": f"sqlite://{str(DATA_DIR)}/db.sqlite" },
|
||||||
"apps": {
|
"apps": {
|
||||||
"models": {
|
"models": {
|
||||||
"models": ["utils.models", "aerich.models"],
|
"models": ["utils.models"],
|
||||||
"default_connection": "default"
|
"default_connection": "default"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,21 +3,30 @@ from tortoise import BaseDBAsyncClient
|
|||||||
|
|
||||||
async def upgrade(db: BaseDBAsyncClient) -> str:
|
async def upgrade(db: BaseDBAsyncClient) -> str:
|
||||||
return """
|
return """
|
||||||
CREATE TABLE IF NOT EXISTS "players" (
|
CREATE TABLE IF NOT EXISTS "ingame_coordinates" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"x" INT NOT NULL,
|
||||||
|
"y" INT NOT NULL,
|
||||||
|
"z" INT NOT NULL
|
||||||
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS "players" (
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
"username" VARCHAR(20) NOT NULL UNIQUE,
|
"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
|
"is_dead" INT NOT NULL DEFAULT 0
|
||||||
) /* */;
|
) /* */;
|
||||||
CREATE TABLE IF NOT EXISTS "player_deaths" (
|
CREATE TABLE IF NOT EXISTS "player_deaths" (
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
"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,
|
"cause" VARCHAR(32) NOT NULL,
|
||||||
"timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
"timestamp" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
"coordinates_id" INT NOT NULL REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
||||||
|
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE TABLE IF NOT EXISTS "player_session" (
|
||||||
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
|
"connected_at" TIMESTAMP NOT NULL,
|
||||||
|
"disconnected_at" TIMESTAMP NOT NULL,
|
||||||
|
"connected_coords_id" INT NOT NULL REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
||||||
|
"disconnected_coords_id" INT REFERENCES "ingame_coordinates" ("id") ON DELETE CASCADE,
|
||||||
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
"player_id" INT NOT NULL REFERENCES "players" ("id") ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
CREATE TABLE IF NOT EXISTS "steam_profile_summary" (
|
CREATE TABLE IF NOT EXISTS "steam_profile_summary" (
|
@ -1,4 +1,3 @@
|
|||||||
aerich==0.8.0
|
|
||||||
aiofiles==24.1.0
|
aiofiles==24.1.0
|
||||||
aiohappyeyeballs==2.4.4
|
aiohappyeyeballs==2.4.4
|
||||||
aiohttp==3.11.9
|
aiohttp==3.11.9
|
||||||
|
Reference in New Issue
Block a user