-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* closes inveniosoftware/invenio-app-rdm#2186 * updated cli to pass ids on create role Co-authored-by: jrcastro2 <[email protected]>
- Loading branch information
Showing
7 changed files
with
208 additions
and
24 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
invenio_accounts/alembic/8f11b75e0995_change_accountsrole_primary_key_to_.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,102 @@ | ||
# # TODO: to be fixed | ||
# # This file is part of Invenio. | ||
# # Copyright (C) 2022 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. | ||
# | ||
# """Change AccountsRole primary key to string.""" | ||
# | ||
# import sqlalchemy as sa | ||
# from alembic import op | ||
# | ||
# # revision identifiers, used by Alembic. | ||
# revision = "8f11b75e0995" | ||
# down_revision = "eb9743315a9d" | ||
# branch_labels = () | ||
# depends_on = "04480be1593e" # Version pre table type change in invenio-access (used in invenio-access for assuring alembic upgrade coherency) | ||
# | ||
# | ||
# def upgrade(): | ||
# """Upgrade database.""" | ||
# # Drop foreign key and change type | ||
# op.drop_constraint( | ||
# "fk_accounts_userrole_role_id", "accounts_userrole", type_="foreignkey" | ||
# ) | ||
# op.alter_column( | ||
# "accounts_userrole", | ||
# "role_id", | ||
# existing_type=sa.Integer, | ||
# type_=sa.String(80), | ||
# postgresql_using="role_id::integer", | ||
# ) | ||
# # Change primary key type | ||
# op.drop_constraint("pk_accounts_role", "accounts_role", type_="primary") | ||
# # server_default=None will remove the autoincrement | ||
# op.alter_column( | ||
# "accounts_role", | ||
# "id", | ||
# existing_type=sa.Integer, | ||
# type_=sa.String(80), | ||
# server_default=None, | ||
# ) | ||
# op.create_primary_key("pk_accounts_role", "accounts_role", ["id"]) | ||
# # Add new column `is_managed` | ||
# op.add_column( | ||
# "accounts_role", | ||
# sa.Column( | ||
# "is_managed", sa.Boolean(name="is_managed"), default=True, nullable=False | ||
# ), | ||
# ) | ||
# # Re-create the foreign key constraint | ||
# op.create_foreign_key( | ||
# "fk_accounts_userrole_role_id", | ||
# "accounts_userrole", | ||
# "accounts_role", | ||
# ["role_id"], | ||
# ["id"], | ||
# ) | ||
# | ||
# | ||
# def downgrade(): | ||
# """Downgrade database.""" | ||
# # Drop foreign key and change type | ||
# op.drop_constraint( | ||
# "fk_accounts_userrole_role_id", "accounts_userrole", type_="foreignkey" | ||
# ) | ||
# op.alter_column( | ||
# "accounts_userrole", | ||
# "role_id", | ||
# existing_type=sa.String(80), | ||
# type_=sa.Integer, | ||
# postgresql_using="role_id::integer", | ||
# ) | ||
# # Change primary key type | ||
# op.drop_constraint("pk_accounts_role", "accounts_role", type_="primary") | ||
# op.alter_column( | ||
# "accounts_role", | ||
# "id", | ||
# existing_type=sa.String(80), | ||
# type_=sa.Integer, | ||
# postgresql_using="id::integer", | ||
# ) | ||
# op.create_primary_key("pk_accounts_role", "accounts_role", ["id"]) | ||
# op.alter_column( | ||
# "accounts_role", | ||
# "id", | ||
# existing_type=sa.String(80), | ||
# type_=sa.Integer, | ||
# autoincrement=True, | ||
# existing_autoincrement=True, | ||
# nullable=False, | ||
# ) | ||
# # Drop new column `is_managed` | ||
# op.drop_column("accounts_role", "is_managed") | ||
# # Re-create the foreign key constraint | ||
# op.create_foreign_key( | ||
# "fk_accounts_userrole_role_id", | ||
# "accounts_userrole", | ||
# "accounts_role", | ||
# ["role_id"], | ||
# ["id"], | ||
# ) |
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