diff --git a/tad/migrations/env.py b/tad/migrations/env.py index 51cd0f77..d5bc0598 100644 --- a/tad/migrations/env.py +++ b/tad/migrations/env.py @@ -3,26 +3,25 @@ from alembic import context from sqlalchemy import engine_from_config, pool +from sqlmodel import SQLModel +from tad.models import * # noqa config = context.config if config.config_file_name is not None: fileConfig(config.config_file_name) -# todo(berry): automaticly import all models -from tad.models.hero import Hero # noqa - -target_metadata = [Hero.metadata] +target_metadata = SQLModel.metadata def get_url(): - scheme = os.getenv("SQLALCHEMY_SCHEME", "sqlite") + scheme = os.getenv("APP_DATABASE_SCHEME", "sqlite") if scheme == "sqlite": - file = os.getenv("SQLITE_FILE", "/database") + file = os.getenv("APP_DATABASE__FILE", "/database") return f"{scheme}:///{file}" - user = os.getenv("APP_DATABASE_USER", "postgres") + user = os.getenv("APP_DATABASE_USER", "tad") password = os.getenv("APP_DATABASE_PASSWORD", "") server = os.getenv("APP_DATABASE_SERVER", "db") port = os.getenv("APP_DATABASE_PORT", "5432") diff --git a/tad/migrations/versions/a1d47bd833f8_added_hero_test_table.py b/tad/migrations/versions/006c480a1920_a_message.py similarity index 86% rename from tad/migrations/versions/a1d47bd833f8_added_hero_test_table.py rename to tad/migrations/versions/006c480a1920_a_message.py index d945dc80..fa83e759 100644 --- a/tad/migrations/versions/a1d47bd833f8_added_hero_test_table.py +++ b/tad/migrations/versions/006c480a1920_a_message.py @@ -1,8 +1,8 @@ -"""Added hero test table +"""a message -Revision ID: a1d47bd833f8 +Revision ID: 006c480a1920 Revises: -Create Date: 2024-05-10 14:00:32.948932 +Create Date: 2024-05-13 12:36:32.647256 """ @@ -13,7 +13,7 @@ from alembic import op # revision identifiers, used by Alembic. -revision: str = "a1d47bd833f8" +revision: str = "006c480a1920" down_revision: str | None = None branch_labels: str | Sequence[str] | None = None depends_on: str | Sequence[str] | None = None