-
Notifications
You must be signed in to change notification settings - Fork 70
Update README for performing DB migrations, add new indexes, update migration params #286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
savathoon
wants to merge
7
commits into
main
Choose a base branch
from
new_indexes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
762e492
Update README for performing DB migrations, add new indexes for compl…
savathoon 59975b2
remove dupe
savathoon d185d23
do this the flask way instead
savathoon 901b1d2
update tests
savathoon ccdd9fb
update tests
savathoon 5f71b19
revert test changes
savathoon e3ee017
resolve test mock race condition in run_sync
savathoon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,95 @@ | ||
| """create new indexes | ||
|
|
||
| Revision ID: 0a113a8bc0df | ||
| Revises: 6d2a03b326f9 | ||
| Create Date: 2025-06-13 10:28:06.674777 | ||
|
|
||
| """ | ||
|
|
||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "0a113a8bc0df" | ||
| down_revision = "6d2a03b326f9" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| with op.batch_alter_table("access_request", schema=None) as batch_op: | ||
| batch_op.create_index("idx_access_request_approved_membership_id", ["approved_membership_id"], unique=False) | ||
| batch_op.create_index("idx_access_request_requested_group_id", ["requested_group_id"], unique=False) | ||
| batch_op.create_index("idx_access_request_requester_user_id", ["requester_user_id"], unique=False) | ||
| batch_op.create_index("idx_access_request_resolver_user_id", ["resolver_user_id"], unique=False) | ||
| batch_op.create_index("idx_access_request_status_resolved", ["status", "resolved_at"], unique=False) | ||
|
|
||
| with op.batch_alter_table("app_group", schema=None) as batch_op: | ||
| batch_op.create_index("idx_app_group_app_id", ["app_id"], unique=False) | ||
|
|
||
| with op.batch_alter_table("okta_user", schema=None) as batch_op: | ||
| batch_op.create_index("idx_okta_user_manager_id", ["manager_id"], unique=False) | ||
|
|
||
| with op.batch_alter_table("okta_user_group_member", schema=None) as batch_op: | ||
| batch_op.create_index("idx_okta_user_group_member_created_actor_id", ["created_actor_id"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_ended_actor_id", ["ended_actor_id"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_group_ended", ["group_id", "ended_at"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_group_id", ["group_id"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_role_group_map_id", ["role_group_map_id"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_user_group", ["user_id", "group_id"], unique=False) | ||
| batch_op.create_index("idx_okta_user_group_member_user_id", ["user_id"], unique=False) | ||
|
|
||
| with op.batch_alter_table("role_group_map", schema=None) as batch_op: | ||
| batch_op.create_index("idx_role_group_map_created_actor_id", ["created_actor_id"], unique=False) | ||
| batch_op.create_index("idx_role_group_map_ended_actor_id", ["ended_actor_id"], unique=False) | ||
| batch_op.create_index("idx_role_group_map_group_id", ["group_id"], unique=False) | ||
| batch_op.create_index("idx_role_group_map_role_id", ["role_id"], unique=False) | ||
|
|
||
| with op.batch_alter_table("role_request", schema=None) as batch_op: | ||
| batch_op.create_index("idx_role_request_approved_membership_id", ["approved_membership_id"], unique=False) | ||
| batch_op.create_index("idx_role_request_requested_group_id", ["requested_group_id"], unique=False) | ||
| batch_op.create_index("idx_role_request_requester_role_id", ["requester_role_id"], unique=False) | ||
| batch_op.create_index("idx_role_request_requester_user_id", ["requester_user_id"], unique=False) | ||
| batch_op.create_index("idx_role_request_resolver_user_id", ["resolver_user_id"], unique=False) | ||
|
|
||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade(): | ||
| # ### commands auto generated by Alembic - please adjust! ### | ||
| with op.batch_alter_table("role_request", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_role_request_resolver_user_id") | ||
| batch_op.drop_index("idx_role_request_requester_user_id") | ||
| batch_op.drop_index("idx_role_request_requester_role_id") | ||
| batch_op.drop_index("idx_role_request_requested_group_id") | ||
| batch_op.drop_index("idx_role_request_approved_membership_id") | ||
|
|
||
| with op.batch_alter_table("role_group_map", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_role_group_map_role_id") | ||
| batch_op.drop_index("idx_role_group_map_group_id") | ||
| batch_op.drop_index("idx_role_group_map_ended_actor_id") | ||
| batch_op.drop_index("idx_role_group_map_created_actor_id") | ||
|
|
||
| with op.batch_alter_table("okta_user_group_member", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_okta_user_group_member_user_id") | ||
| batch_op.drop_index("idx_okta_user_group_member_user_group") | ||
| batch_op.drop_index("idx_okta_user_group_member_role_group_map_id") | ||
| batch_op.drop_index("idx_okta_user_group_member_group_id") | ||
| batch_op.drop_index("idx_okta_user_group_member_group_ended") | ||
| batch_op.drop_index("idx_okta_user_group_member_ended_actor_id") | ||
| batch_op.drop_index("idx_okta_user_group_member_created_actor_id") | ||
|
|
||
| with op.batch_alter_table("okta_user", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_okta_user_manager_id") | ||
|
|
||
| with op.batch_alter_table("app_group", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_app_group_app_id") | ||
|
|
||
| with op.batch_alter_table("access_request", schema=None) as batch_op: | ||
| batch_op.drop_index("idx_access_request_status_resolved") | ||
| batch_op.drop_index("idx_access_request_resolver_user_id") | ||
| batch_op.drop_index("idx_access_request_requester_user_id") | ||
| batch_op.drop_index("idx_access_request_requested_group_id") | ||
| batch_op.drop_index("idx_access_request_approved_membership_id") | ||
|
|
||
| # ### end Alembic commands ### |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I thought Foreign Keys were automatically indexed, but looking further I guess not?
https://stackoverflow.com/a/970605
https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK
Good find!