Skip to content

Commit

Permalink
revert: deleted alias user id model and migration (#2306)
Browse files Browse the repository at this point in the history
  • Loading branch information
cquintana92 authored Nov 6, 2024
1 parent a8ca2d3 commit db4eb69
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
6 changes: 0 additions & 6 deletions app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2306,12 +2306,6 @@ class DeletedAlias(Base, ModelMixin):
server_default=str(AliasDeleteReason.Unspecified.value),
)

user_id = sa.Column(sa.Integer, nullable=True, default=None, server_default=None)

__table_args__ = (
sa.Index("ix_deleted_alias_user_id_created_at", "user_id", "created_at"),
)

@classmethod
def create(cls, **kw):
raise Exception("should use delete_alias(alias,user) instead")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Revert user id on deleted alias
Revision ID: bc9aa210efa3
Revises: 4882cc49dde9
Create Date: 2024-11-06 12:44:44.129691
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'bc9aa210efa3'
down_revision = '4882cc49dde9'
branch_labels = None
depends_on = None


def upgrade():
with op.get_context().autocommit_block():
op.drop_index('ix_deleted_alias_user_id_created_at', table_name='deleted_alias')
op.drop_column('deleted_alias', 'user_id')


def downgrade():
op.add_column('deleted_alias', sa.Column('user_id', sa.Integer(), server_default=None, nullable=True))
with op.get_context().autocommit_block():
op.create_index('ix_deleted_alias_user_id_created_at', 'deleted_alias', ['user_id', 'created_at'], unique=False, postgresql_concurrently=True)

0 comments on commit db4eb69

Please sign in to comment.