wip
This commit is contained in:
parent
6b1c60a550
commit
839cbd0dc0
17 changed files with 213 additions and 35 deletions
|
|
@ -4,6 +4,7 @@ from alembic import context
|
|||
from sqlalchemy import engine_from_config, pool
|
||||
from sqlmodel import SQLModel
|
||||
|
||||
from learn_sql_model.config import get_config
|
||||
from learn_sql_model.models.hero import Hero
|
||||
from learn_sql_model.models.pet import Pet
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ def run_migrations_offline() -> None:
|
|||
script output.
|
||||
|
||||
"""
|
||||
url = config.get_main_option("sqlalchemy.url")
|
||||
url = get_config().database_url
|
||||
context.configure(
|
||||
url=url,
|
||||
target_metadata=target_metadata,
|
||||
|
|
@ -78,7 +79,7 @@ def run_migrations_online() -> None:
|
|||
context.configure(
|
||||
connection=connection,
|
||||
target_metadata=target_metadata,
|
||||
render_as_batch=True,
|
||||
render_as_batch=False,
|
||||
version_table=f'{config.get_main_option("project")}_alembic_version',
|
||||
)
|
||||
|
||||
|
|
|
|||
29
migrations/versions/a9bb6625c57b_add_birthday.py
Normal file
29
migrations/versions/a9bb6625c57b_add_birthday.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"""add birthday
|
||||
|
||||
Revision ID: a9bb6625c57b
|
||||
Revises: c8516c888495
|
||||
Create Date: 2023-05-25 19:00:58.137464
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'a9bb6625c57b'
|
||||
down_revision = 'c8516c888495'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('pet', sa.Column('birthday', sa.DateTime(), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('pet', 'birthday')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
"""init
|
||||
|
||||
Revision ID: 2a221363b5f8
|
||||
Revision ID: c8516c888495
|
||||
Revises:
|
||||
Create Date: 2023-05-21 20:52:12.693194
|
||||
Create Date: 2023-05-25 18:42:37.057225
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
|
@ -11,7 +11,7 @@ import sqlmodel
|
|||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '2a221363b5f8'
|
||||
revision = 'c8516c888495'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
Loading…
Add table
Add a link
Reference in a new issue