fix: remove duplicate alembic migration causing multiple heads on startup
This commit is contained in:
parent
1536e98c8b
commit
7a1042741e
2 changed files with 1 additions and 50 deletions
|
|
@ -1,49 +0,0 @@
|
||||||
"""add listing decision
|
|
||||||
|
|
||||||
Revision ID: d7e8f9a0b1c2
|
|
||||||
Revises: c5d6e7f8a9b0
|
|
||||||
Create Date: 2026-02-21 12:00:00.000000
|
|
||||||
|
|
||||||
"""
|
|
||||||
from typing import Sequence, Union
|
|
||||||
|
|
||||||
from alembic import op
|
|
||||||
import sqlalchemy as sa
|
|
||||||
import sqlmodel
|
|
||||||
|
|
||||||
|
|
||||||
# revision identifiers, used by Alembic.
|
|
||||||
revision: str = 'd7e8f9a0b1c2'
|
|
||||||
down_revision: Union[str, None] = 'c5d6e7f8a9b0'
|
|
||||||
branch_labels: Union[str, Sequence[str], None] = None
|
|
||||||
depends_on: Union[str, Sequence[str], None] = None
|
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
|
||||||
"""Create listingdecision table."""
|
|
||||||
op.create_table('listingdecision',
|
|
||||||
sa.Column('id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('user_id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('listing_id', sa.Integer(), nullable=False),
|
|
||||||
sa.Column('listing_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('decision', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
|
||||||
sa.Column('created_at', sa.DateTime(), nullable=True,
|
|
||||||
server_default=sa.func.now()),
|
|
||||||
sa.Column('updated_at', sa.DateTime(), nullable=True,
|
|
||||||
server_default=sa.func.now()),
|
|
||||||
sa.ForeignKeyConstraint(['user_id'], ['user.id']),
|
|
||||||
sa.PrimaryKeyConstraint('id'),
|
|
||||||
sa.UniqueConstraint('user_id', 'listing_id', 'listing_type',
|
|
||||||
name='uq_decision_user_listing_type'),
|
|
||||||
)
|
|
||||||
op.create_index(op.f('ix_listingdecision_user_id'),
|
|
||||||
'listingdecision', ['user_id'], unique=False)
|
|
||||||
op.create_index(op.f('ix_listingdecision_listing_id'),
|
|
||||||
'listingdecision', ['listing_id'], unique=False)
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
|
||||||
"""Drop listingdecision table."""
|
|
||||||
op.drop_index(op.f('ix_listingdecision_listing_id'), table_name='listingdecision')
|
|
||||||
op.drop_index(op.f('ix_listingdecision_user_id'), table_name='listingdecision')
|
|
||||||
op.drop_table('listingdecision')
|
|
||||||
|
|
@ -7,7 +7,7 @@ class ListingDecision(SQLModel, table=True):
|
||||||
__table_args__ = (
|
__table_args__ = (
|
||||||
UniqueConstraint(
|
UniqueConstraint(
|
||||||
'user_id', 'listing_id', 'listing_type',
|
'user_id', 'listing_id', 'listing_type',
|
||||||
name='uq_decision_user_listing_type',
|
name='uq_decision_user_listing',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue