uow and di basic implementation

This commit is contained in:
2024-03-06 03:59:16 +03:00
parent 8d93c964e1
commit f9631a712b
11 changed files with 50 additions and 19 deletions

View File

@@ -3,7 +3,7 @@ from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
import api.model.user # type: ignore
import api.models as models
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
@@ -18,7 +18,7 @@ if config.config_file_name is not None:
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata
target_metadata = api.model.user.Base.metadata
target_metadata = models.Base.metadata
# other values from the config, defined by the needs of env.py,
# can be acquired:

View File

@@ -1,8 +1,8 @@
"""initial
Revision ID: ec1380cb4f18
Revision ID: 3ba730985688
Revises:
Create Date: 2024-03-04 03:11:36.206211
Create Date: 2024-03-06 03:10:09.050166
"""
@@ -12,7 +12,7 @@ import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "ec1380cb4f18"
revision: str = "3ba730985688"
down_revision: str | None = None
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
@@ -22,10 +22,11 @@ def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"users",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("email", sa.String(), nullable=True),
sa.Column("hashed_password", sa.String(), nullable=True),
sa.Column("is_active", sa.Boolean(), nullable=True),
sa.Column("name", sa.String(), nullable=False),
sa.Column("id", sa.UUID(), nullable=False),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("email"),
)