mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
42 lines
1.3 KiB
Python
42 lines
1.3 KiB
Python
"""post licence
|
|
|
|
Revision ID: e23ce3d53def
|
|
Revises: 7fc066ad475a
|
|
Create Date: 2024-11-02 15:12:05.885114
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = 'e23ce3d53def'
|
|
down_revision = '7fc066ad475a'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('licence',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('name', sa.String(length=50), nullable=True),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column('licence_id', sa.Integer(), nullable=True))
|
|
batch_op.create_index(batch_op.f('ix_post_licence_id'), ['licence_id'], unique=False)
|
|
batch_op.create_foreign_key(None, 'licence', ['licence_id'], ['id'])
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table('post', schema=None) as batch_op:
|
|
batch_op.drop_constraint(None, type_='foreignkey')
|
|
batch_op.drop_index(batch_op.f('ix_post_licence_id'))
|
|
batch_op.drop_column('licence_id')
|
|
|
|
op.drop_table('licence')
|
|
# ### end Alembic commands ###
|