added ability for db migration

This commit is contained in:
Jun-te Kim 2025-03-28 10:41:59 +00:00
parent d212509e34
commit fd456762dd
2 changed files with 41 additions and 0 deletions

View file

@ -0,0 +1,39 @@
"""initla db
Revision ID: b650a366b88d
Revises:
Create Date: 2025-03-28 10:36:15.235350
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'b650a366b88d'
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:
"""Upgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('assessorinfo')
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('assessorinfo',
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
sa.Column('accreditation_number', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('name', sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column('phone_number', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.Column('email_address', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='assessorinfo_pkey')
)
# ### end Alembic commands ###

2
migration_db.sh Normal file
View file

@ -0,0 +1,2 @@
poetry run alembic revision --autogenerate -m "some msg"
#poetry upgrade head