mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
feat: init alembic + add init revision
This commit is contained in:
parent
9cf84b959d
commit
04c05e4f9a
7 changed files with 348 additions and 8 deletions
|
|
@ -0,0 +1,51 @@
|
|||
"""Initial Migration
|
||||
|
||||
Revision ID: df2981bf24dd
|
||||
Revises:
|
||||
Create Date: 2024-07-11 19:33:37.993767
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
from grpc import server
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'df2981bf24dd'
|
||||
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.add_column('activity', sa.Column('published', sa.Boolean(), nullable=False, server_default=sa.true()))
|
||||
op.drop_column('activity', 'published_version')
|
||||
op.drop_column('activity', 'version')
|
||||
|
||||
op.drop_column('assignmentusersubmission', 'assignment_user_uuid')
|
||||
|
||||
op.drop_constraint('trail_org_id_fkey', 'trail', type_='foreignkey')
|
||||
op.create_foreign_key('trail_org_id_fkey', 'trail', 'organization', ['org_id'], ['id'], ondelete='CASCADE')
|
||||
op.drop_constraint('trail_user_id_fkey', 'trail', type_='foreignkey')
|
||||
op.create_foreign_key('trail_user_id_fkey', 'trail', 'user', ['user_id'], ['id'], ondelete='CASCADE')
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint('trail_org_id_fkey', 'trail', type_='foreignkey')
|
||||
op.create_foreign_key('trail_org_id_fkey', 'trail', 'organization', ['org_id'], ['id'])
|
||||
op.drop_constraint('trail_user_id_fkey', 'trail', type_='foreignkey')
|
||||
op.create_foreign_key('trail_user_id_fkey', 'trail', 'user', ['user_id'], ['id'])
|
||||
|
||||
op.add_column('assignmentusersubmission', sa.Column('assignment_user_uuid', sa.VARCHAR(), autoincrement=False, nullable=False))
|
||||
|
||||
op.add_column('activity', sa.Column('version', sa.INTEGER(), autoincrement=False, nullable=False , server_default=sa.text('1')))
|
||||
op.add_column('activity', sa.Column('published_version', sa.INTEGER(), autoincrement=False, nullable=False , server_default=sa.text('1')) )
|
||||
op.drop_column('activity', 'published')
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue