Major rework, breaking migrations starting over

This commit is contained in:
Timothy Rogers 2025-05-24 10:38:21 -04:00
parent c4b8d3e4ed
commit c7586d1aa1
4 changed files with 47 additions and 55 deletions

View file

@ -0,0 +1 @@

View file

@ -0,0 +1,46 @@
"""Initial migration
Revision ID: ac1b5e061bd9
Revises:
Create Date: 2025-05-24 09:23:49.162560
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ac1b5e061bd9'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('asset',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('title', sa.String(length=100), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('featured_image', sa.String(length=200), nullable=True),
sa.Column('original_featured_image', sa.String(length=200), nullable=True),
sa.Column('license_key', sa.String(length=255), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('asset_file',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('filename', sa.String(length=200), nullable=False),
sa.Column('original_filename', sa.String(length=200), nullable=True),
sa.Column('asset_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['asset_id'], ['asset.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('asset_file')
op.drop_table('asset')
# ### end Alembic commands ###

View file

@ -1,23 +0,0 @@
"""Add original_featured_image column
Revision ID: 1234567890ab
Revises:
Create Date: 2023-XX-XX
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1234567890ab'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# Add the new column
op.add_column('asset', sa.Column('original_featured_image', sa.String(200)))
def downgrade():
# Remove the column
op.drop_column('asset', 'original_featured_image')

View file

@ -1,32 +0,0 @@
"""Add license-key column
Revision ID: bea92ecef03b
Revises: 1234567890ab
Create Date: 2024-10-31 12:16:06.022171
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'bea92ecef03b'
down_revision = '1234567890ab'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('asset', schema=None) as batch_op:
batch_op.add_column(sa.Column('license_key', sa.String(length=255), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('asset', schema=None) as batch_op:
batch_op.drop_column('license_key')
# ### end Alembic commands ###