-
Notifications
You must be signed in to change notification settings - Fork 992
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'galaxyproject:dev' into FastAPI_library_contents
- Loading branch information
Showing
91 changed files
with
4,203 additions
and
826 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
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
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
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
42 changes: 42 additions & 0 deletions
42
...l/migrations/alembic/versions_gxy/13fe10b8e35b_add_not_null_constraints_to_user_group_.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 @@ | ||
"""Add not-null constraints to user_group_association | ||
Revision ID: 13fe10b8e35b | ||
Revises: 56ddf316dbd0 | ||
Create Date: 2024-09-09 21:26:26.032842 | ||
""" | ||
|
||
from alembic import op | ||
|
||
from galaxy.model.migrations.data_fixes.association_table_fixer import UserGroupAssociationNullFix | ||
from galaxy.model.migrations.util import ( | ||
alter_column, | ||
transaction, | ||
) | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "13fe10b8e35b" | ||
down_revision = "56ddf316dbd0" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
table_name = "user_group_association" | ||
|
||
|
||
def upgrade(): | ||
with transaction(): | ||
_remove_records_with_nulls() | ||
alter_column(table_name, "user_id", nullable=False) | ||
alter_column(table_name, "group_id", nullable=False) | ||
|
||
|
||
def downgrade(): | ||
with transaction(): | ||
alter_column(table_name, "user_id", nullable=True) | ||
alter_column(table_name, "group_id", nullable=True) | ||
|
||
|
||
def _remove_records_with_nulls(): | ||
"""Remove associations having null as user_id or group_id""" | ||
connection = op.get_bind() | ||
UserGroupAssociationNullFix(connection).run() |
52 changes: 52 additions & 0 deletions
52
...laxy/model/migrations/alembic/versions_gxy/1cf595475b58_email_column_unique_constraint.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,52 @@ | ||
"""Email column unique constraint | ||
Revision ID: 1cf595475b58 | ||
Revises: d619fdfa6168 | ||
Create Date: 2024-07-03 19:53:22.443016 | ||
""" | ||
|
||
from alembic import op | ||
|
||
from galaxy.model.database_object_names import build_index_name | ||
from galaxy.model.migrations.data_fixes.user_table_fixer import EmailDeduplicator | ||
from galaxy.model.migrations.util import ( | ||
create_index, | ||
drop_index, | ||
index_exists, | ||
transaction, | ||
) | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1cf595475b58" | ||
down_revision = "d619fdfa6168" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
table_name = "galaxy_user" | ||
column_name = "email" | ||
index_name = build_index_name(table_name, [column_name]) | ||
|
||
|
||
def upgrade(): | ||
with transaction(): | ||
_fix_duplicate_emails() | ||
# Existing databases may have an existing index we no longer need | ||
# New databases will not have that index, so we must check. | ||
if index_exists(index_name, table_name, False): | ||
drop_index(index_name, table_name) | ||
# Create a UNIQUE index | ||
create_index(index_name, table_name, [column_name], unique=True) | ||
|
||
|
||
def downgrade(): | ||
with transaction(): | ||
drop_index(index_name, table_name) | ||
# Restore a non-unique index | ||
create_index(index_name, table_name, [column_name]) | ||
|
||
|
||
def _fix_duplicate_emails(): | ||
"""Fix records with duplicate usernames""" | ||
connection = op.get_bind() | ||
EmailDeduplicator(connection).run() |
42 changes: 42 additions & 0 deletions
42
...el/migrations/alembic/versions_gxy/1fdd615f2cdb_add_not_null_constraints_to_user_role_.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 @@ | ||
"""Add not-null constraints to user_role_association | ||
Revision ID: 1fdd615f2cdb | ||
Revises: 349dd9d9aac9 | ||
Create Date: 2024-09-09 21:28:11.987054 | ||
""" | ||
|
||
from alembic import op | ||
|
||
from galaxy.model.migrations.data_fixes.association_table_fixer import UserRoleAssociationNullFix | ||
from galaxy.model.migrations.util import ( | ||
alter_column, | ||
transaction, | ||
) | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1fdd615f2cdb" | ||
down_revision = "349dd9d9aac9" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
table_name = "user_role_association" | ||
|
||
|
||
def upgrade(): | ||
with transaction(): | ||
_remove_records_with_nulls() | ||
alter_column(table_name, "user_id", nullable=False) | ||
alter_column(table_name, "role_id", nullable=False) | ||
|
||
|
||
def downgrade(): | ||
with transaction(): | ||
alter_column(table_name, "user_id", nullable=True) | ||
alter_column(table_name, "role_id", nullable=True) | ||
|
||
|
||
def _remove_records_with_nulls(): | ||
"""Remove associations having null as user_id or role_id""" | ||
connection = op.get_bind() | ||
UserRoleAssociationNullFix(connection).run() |
Oops, something went wrong.