From b4bab34a4d57b8016701338fb52155d2ca762eea Mon Sep 17 00:00:00 2001 From: Mads Bisgaard <126242332+bisgaard-itis@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:09:19 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Add=20index=20to=20checksum=20(#?= =?UTF-8?q?5748)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../1c069f85d5fd_add_index_to_checksum.py | 33 +++++++++++++++++++ .../models/file_meta_data.py | 1 + 2 files changed, 34 insertions(+) create mode 100644 packages/postgres-database/src/simcore_postgres_database/migration/versions/1c069f85d5fd_add_index_to_checksum.py diff --git a/packages/postgres-database/src/simcore_postgres_database/migration/versions/1c069f85d5fd_add_index_to_checksum.py b/packages/postgres-database/src/simcore_postgres_database/migration/versions/1c069f85d5fd_add_index_to_checksum.py new file mode 100644 index 00000000000..63764630a0c --- /dev/null +++ b/packages/postgres-database/src/simcore_postgres_database/migration/versions/1c069f85d5fd_add_index_to_checksum.py @@ -0,0 +1,33 @@ +"""add index to checksum + +Revision ID: 1c069f85d5fd +Revises: b13ca15c7ef8 +Create Date: 2024-04-26 11:46:55.745033+00:00 + +""" +from alembic import op + +# revision identifiers, used by Alembic. +revision = "1c069f85d5fd" +down_revision = "b13ca15c7ef8" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.create_index( + op.f("ix_file_meta_data_sha256_checksum"), + "file_meta_data", + ["sha256_checksum"], + unique=False, + ) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_index( + op.f("ix_file_meta_data_sha256_checksum"), table_name="file_meta_data" + ) + # ### end Alembic commands ### diff --git a/packages/postgres-database/src/simcore_postgres_database/models/file_meta_data.py b/packages/postgres-database/src/simcore_postgres_database/models/file_meta_data.py index 9bb6eb654d7..9ece039863f 100644 --- a/packages/postgres-database/src/simcore_postgres_database/models/file_meta_data.py +++ b/packages/postgres-database/src/simcore_postgres_database/models/file_meta_data.py @@ -54,5 +54,6 @@ nullable=True, server_default=sa.null(), doc="SHA256 checksum of the file content", + index=True, ), )