45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
"""auto
|
|
|
|
Revision ID: 64c1927562cc
|
|
Revises: fb0243eaa7c3
|
|
Create Date: 2025-06-06 07:54:00.147383
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '64c1927562cc'
|
|
down_revision = 'fb0243eaa7c3'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('media', sa.Column('plant_id', sa.Integer(), nullable=True))
|
|
op.add_column('media', sa.Column('update_id', sa.Integer(), nullable=True))
|
|
op.drop_constraint(op.f('media_ibfk_2'), 'media', type_='foreignkey')
|
|
op.drop_constraint(op.f('media_ibfk_3'), 'media', type_='foreignkey')
|
|
op.create_foreign_key(None, 'media', 'plant', ['plant_id'], ['id'])
|
|
op.create_foreign_key(None, 'media', 'plant_updates', ['update_id'], ['id'])
|
|
op.drop_column('media', 'uploader_id')
|
|
op.drop_column('media', 'submission_id')
|
|
op.drop_column('media', 'caption')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.add_column('media', sa.Column('caption', mysql.VARCHAR(length=255), nullable=True))
|
|
op.add_column('media', sa.Column('submission_id', mysql.INTEGER(), autoincrement=False, nullable=True))
|
|
op.add_column('media', sa.Column('uploader_id', mysql.INTEGER(), autoincrement=False, nullable=False))
|
|
op.drop_constraint(None, 'media', type_='foreignkey')
|
|
op.drop_constraint(None, 'media', type_='foreignkey')
|
|
op.create_foreign_key(op.f('media_ibfk_3'), 'media', 'submissions', ['submission_id'], ['id'])
|
|
op.create_foreign_key(op.f('media_ibfk_2'), 'media', 'users', ['uploader_id'], ['id'])
|
|
op.drop_column('media', 'update_id')
|
|
op.drop_column('media', 'plant_id')
|
|
# ### end Alembic commands ###
|