Skip to content

Commit b6574ef

Browse files
authored
Merge pull request #1411 from microbiomedata/1410-bulk-download-association-index
Create index on download/data object association
2 parents 219f034 + 2292ee2 commit b6574ef

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
"""Create index on column `data_object_id` for table `bulk_download_data_object`
2+
3+
Revision ID: 2ec2d0b4f840
4+
Revises: 5fb9910ca8e6
5+
Create Date: 2024-10-10 16:48:37.051479
6+
7+
"""
8+
9+
from typing import Optional
10+
11+
from alembic import op
12+
13+
# revision identifiers, used by Alembic.
14+
revision: str = "2ec2d0b4f840"
15+
down_revision: Optional[str] = "5fb9910ca8e6"
16+
branch_labels: Optional[str] = None
17+
depends_on: Optional[str] = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.create_index(
23+
"bulk_download_data_object_id_idx",
24+
"bulk_download_data_object",
25+
["data_object_id"],
26+
unique=False,
27+
)
28+
# ### end Alembic commands ###
29+
30+
31+
def downgrade():
32+
# ### commands auto generated by Alembic - please adjust! ###
33+
op.drop_index("bulk_download_data_object_id_idx", table_name="bulk_download_data_object")
34+
# ### end Alembic commands ###

nmdc_server/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
Enum,
1313
Float,
1414
ForeignKey,
15+
Index,
1516
Integer,
1617
LargeBinary,
1718
String,
@@ -834,6 +835,9 @@ class BulkDownloadDataObject(Base):
834835
)
835836

836837

838+
Index("bulk_download_data_object_id_idx", BulkDownloadDataObject.data_object_id)
839+
840+
837841
class EnvoTree(Base):
838842
__tablename__ = "envo_tree"
839843

0 commit comments

Comments
 (0)