Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Gotsman committed Apr 3, 2024
1 parent 54e80bd commit 47cb91e
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 206 deletions.
8 changes: 2 additions & 6 deletions customer_data_app/alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool

from alembic import context
from sqlalchemy import engine_from_config, pool

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down Expand Up @@ -64,9 +62,7 @@ def run_migrations_online() -> None:
)

with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
context.configure(connection=connection, target_metadata=target_metadata)

with context.begin_transaction():
context.run_migrations()
Expand Down
27 changes: 14 additions & 13 deletions customer_data_app/alembic/versions/333b61328fdd_.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""empty message
"""empty message.
Revision ID: 333b61328fdd
Revises:
Expand All @@ -7,33 +7,34 @@
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel
from alembic import op

# revision identifiers, used by Alembic.
revision: str = '333b61328fdd'
revision: str = "333b61328fdd"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('customer',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('icon', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('email', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('phone', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column('edit', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint('id')
op.create_table(
"customer",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("icon", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("name", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("email", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("phone", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("address", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.Column("edit", sqlmodel.sql.sqltypes.AutoString(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('customer')
op.drop_table("customer")
# ### end Alembic commands ###
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""something changed
"""something changed.
Revision ID: e565fdc23e6c
Revises: 333b61328fdd
Expand All @@ -7,26 +7,29 @@
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
import sqlmodel
from alembic import op

# revision identifiers, used by Alembic.
revision: str = 'e565fdc23e6c'
down_revision: Union[str, None] = '333b61328fdd'
revision: str = "e565fdc23e6c"
down_revision: Union[str, None] = "333b61328fdd"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('customer', 'edit')
op.drop_column('customer', 'icon')
op.drop_column("customer", "edit")
op.drop_column("customer", "icon")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('customer', sa.Column('icon', sa.VARCHAR(), autoincrement=False, nullable=False))
op.add_column('customer', sa.Column('edit', sa.VARCHAR(), autoincrement=False, nullable=False))
op.add_column(
"customer", sa.Column("icon", sa.VARCHAR(), autoincrement=False, nullable=False)
)
op.add_column(
"customer", sa.Column("edit", sa.VARCHAR(), autoincrement=False, nullable=False)
)
# ### end Alembic commands ###
Loading

0 comments on commit 47cb91e

Please sign in to comment.