Skip to content

Commit

Permalink
Add alembic test version
Browse files Browse the repository at this point in the history
  • Loading branch information
berrydenhartog committed May 8, 2024
1 parent 835c365 commit c94b3e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ repos:
- id: trailing-whitespace
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-added-large-files
- id: check-merge-conflict
- id: check-toml
Expand Down
2 changes: 2 additions & 0 deletions tad/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ def run_migrations_online():
"""
configuration = config.get_section(config.config_ini_section)
if configuration is None:
raise Exception("Failed to get configuration section") # noqa: TRY003, TRY002
configuration["sqlalchemy.url"] = get_url()
connectable = engine_from_config(
configuration,
Expand Down
24 changes: 3 additions & 21 deletions tad/alembic/versions/99fb931b1324_.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from collections.abc import Sequence

import sqlalchemy as sa
import sqlmodel.sql.sqltypes

from alembic import op

Expand All @@ -21,32 +20,15 @@


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"hero",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("secret_name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("name", sa.String(), nullable=False),
sa.Column("secret_name", sa.String(), nullable=False),
sa.Column("age", sa.Integer(), nullable=True),
sa.PrimaryKeyConstraint("id"),
)
op.create_table(
"user",
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("is_active", sa.Boolean(), nullable=False),
sa.Column("is_superuser", sa.Boolean(), nullable=False),
sa.Column("full_name", sqlmodel.sql.sqltypes.AutoString(), nullable=True),
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("hashed_password", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(op.f("ix_user_email"), "user", ["email"], unique=True)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_user_email"), table_name="user")
op.drop_table("user")
op.drop_table("hero")
# ### end Alembic commands ###
pass

0 comments on commit c94b3e5

Please sign in to comment.