Skip to content

Commit

Permalink
Removed index removal from v0.7.0 alembic revision
Browse files Browse the repository at this point in the history
  • Loading branch information
joaovitoriasilva committed Dec 28, 2024
1 parent 470fa58 commit a29423f
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions backend/app/alembic/versions/446a199ddd37_v0_7_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from typing import Sequence, Union

from alembic import op
from sqlalchemy.engine.reflection import Inspector
import sqlalchemy as sa

# revision identifiers, used by Alembic.
Expand All @@ -19,21 +18,6 @@


def upgrade() -> None:
# Get database connection and inspect constraints
conn = op.get_bind()
inspector = Inspector.from_engine(conn)

# Get the list of indexes on the 'activities' table
indexes = inspector.get_indexes('activities')

# Check if the target index exists
index_name = 'activities_garminconnect_activity_id_key'
index_exists = any(index['name'] == index_name for index in indexes)

if index_exists:
# Drop the index if it exists
op.drop_index(index_name, table_name='activities')

# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('users', 'password',
existing_type=sa.VARCHAR(length=100),
Expand All @@ -50,5 +34,4 @@ def downgrade() -> None:
type_=sa.VARCHAR(length=100),
existing_comment='User password (hash)',
existing_nullable=False)
op.create_unique_constraint('activities_garminconnect_activity_id_key', 'activities', ['garminconnect_activity_id'])
# ### end Alembic commands ###

0 comments on commit a29423f

Please sign in to comment.