-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Clean up indexes on files and requests to make delete more efficient * Don't allow the user lookup in the auth decorator to leave a dangling transaction We are moving from implicit transactions to more fine-grain control. We don't want to completely turn off implicit transactions during this migration, so any database interaction can start the transaction which can spoil things later on. This decorator was causing a transaction to be started for any user-facing REST endpoint. Change this so it runs in its own transaction and commits it before entering the endpoint code. * Fix last remaining reference to the archived property on requests
- Loading branch information
1 parent
a42ace9
commit d66f0ca
Showing
4 changed files
with
60 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
"""empty message | ||
Revision ID: 1.5.6 | ||
Revises: v1_5_5 | ||
Create Date: 2024-11-23 17:30:18.079736 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'v1_5_6' | ||
down_revision = 'v1_5_5' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
""" | ||
Clean up indexes and constraints in the database | ||
""" | ||
def upgrade(): | ||
op.drop_index('ix_dataset_id', table_name='files') | ||
op.drop_constraint('files_dataset_id_fkey', 'files', type_='foreignkey') | ||
op.create_foreign_key(None, 'files', 'datasets', ['dataset_id'], ['id']) | ||
op.alter_column('requests', 'files', | ||
existing_type=sa.INTEGER(), | ||
nullable=False) | ||
op.drop_index('ix_transform_result_request_id', table_name='transform_result') | ||
op.drop_index('ix_transform_result_transform_status', table_name='transform_result') | ||
op.create_index(op.f('ix_users_sub'), 'users', ['sub'], unique=True) | ||
|
||
|
||
def downgrade(): | ||
op.drop_index(op.f('ix_users_sub'), table_name='users') | ||
op.create_index('ix_transform_result_transform_status', 'transform_result', ['transform_status'], unique=False) | ||
op.create_index('ix_transform_result_request_id', 'transform_result', ['request_id'], unique=False) | ||
op.alter_column('requests', 'files', | ||
existing_type=sa.INTEGER(), | ||
nullable=True) | ||
op.drop_constraint(None, 'files', type_='foreignkey') | ||
op.create_foreign_key('files_dataset_id_fkey', 'files', 'datasets', ['dataset_id'], ['id'], ondelete='CASCADE') | ||
op.create_index('ix_dataset_id', 'files', ['dataset_id'], unique=False) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters