-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds alembic recipe * closes zenodo/rdm-project#640
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
invenio_communities/alembic/72b37bb4119c_create_indeces_for_bucket_id.py
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,42 @@ | ||
# | ||
# This file is part of Invenio. | ||
# Copyright (C) 2023 CERN. | ||
# | ||
# Invenio is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""Create indeces for bucket_id.""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "72b37bb4119c" | ||
down_revision = "5c68d45c80f0" | ||
branch_labels = () | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
"""Upgrade database.""" | ||
op.create_index( | ||
op.f("ix_communities_metadata_bucket_id"), | ||
"communities_metadata", | ||
["bucket_id"], | ||
unique=False, | ||
) | ||
op.create_index( | ||
op.f("ix_communities_files_object_version_id"), | ||
"communities_files", | ||
["object_version_id"], | ||
unique=False, | ||
) | ||
|
||
|
||
def downgrade(): | ||
"""Downgrade database.""" | ||
op.drop_index( | ||
op.f("ix_communities_metadata_bucket_id"), table_name="communities_metadata" | ||
) | ||
op.drop_index( | ||
op.f("ix_communities_files_object_version_id"), table_name="communities_files" | ||
) |
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