-
Notifications
You must be signed in to change notification settings - Fork 32
✨ Add ordering to function jobs inside a function job collection #8487
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
Merged
wvangeit
merged 20 commits into
ITISFoundation:master
from
wvangeit:fix_duplicate_map_inputs
Oct 14, 2025
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
070be9e
Split functions repo in different files
wvangeit f55ff68
Merge branch 'master' into split_func_repos_files
wvangeit ed4559d
Fix linting
wvangeit b510247
Merge branch 'split_func_repos_files' of github.com:wvangeit/osparc-s…
wvangeit c4fccd0
Add an 'order' column to function job collection table
wvangeit 13a35b5
Add the db migration
wvangeit ab119d5
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 85cf82d
Reset primary keys in downgrade
wvangeit fd92c8e
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit dba8dd7
Add some tests
wvangeit 35f4330
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit c74ceb5
Fix comments
wvangeit 93540ad
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 6d92290
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 73643d9
Small comment fix
wvangeit fab9b18
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 849e0e4
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit df44672
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 4c665f7
Merge db heads
wvangeit 8d3a66a
Merge branch 'master' into fix_duplicate_map_inputs
wvangeit 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
73 changes: 73 additions & 0 deletions
73
...ostgres_database/migration/versions/06596ce2bc3e_add_order_to_function_job_collections.py
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,73 @@ | ||
| """add order to function job collections | ||
|
|
||
| Revision ID: 06596ce2bc3e | ||
| Revises: 9dddb16914a4 | ||
| Create Date: 2025-10-08 13:54:39.943703+00:00 | ||
|
|
||
| """ | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "06596ce2bc3e" | ||
| down_revision = "9dddb16914a4" | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| op.add_column( | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| sa.Column("order", sa.Integer(), default=0, nullable=True), | ||
| ) | ||
| # Set the "order" column so that it restarts from 1 for each collection_id, | ||
| # ordering by function_job_id within each collection | ||
| op.execute( | ||
| sa.text( | ||
| """ | ||
| UPDATE funcapi_function_job_collections_to_function_jobs | ||
| SET "order" = sub.row_number | ||
| FROM ( | ||
| SELECT function_job_collection_uuid, function_job_uuid, | ||
| ROW_NUMBER() OVER (PARTITION BY function_job_collection_uuid) AS row_number | ||
| FROM funcapi_function_job_collections_to_function_jobs | ||
| ) AS sub | ||
| WHERE funcapi_function_job_collections_to_function_jobs.function_job_collection_uuid = sub.function_job_collection_uuid | ||
| AND funcapi_function_job_collections_to_function_jobs.function_job_uuid = sub.function_job_uuid | ||
| """ | ||
| ) | ||
| ) | ||
| op.drop_constraint( | ||
| "funcapi_function_job_collections_to_function_jobs_pk", | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| type_="primary", | ||
| ) | ||
| op.create_primary_key( | ||
| "funcapi_function_job_collections_to_function_jobs_pk", | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| ["function_job_collection_uuid", "order"], | ||
| ) | ||
| op.alter_column( | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| "order", | ||
| existing_type=sa.Integer(), | ||
| nullable=False, | ||
| ) | ||
| # ### end Alembic commands ### | ||
|
|
||
|
|
||
| def downgrade(): | ||
| op.drop_constraint( | ||
| "funcapi_function_job_collections_to_function_jobs_pk", | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| type_="primary", | ||
| ) | ||
| op.create_primary_key( | ||
| "funcapi_function_job_collections_to_function_jobs_pk", | ||
| "funcapi_function_job_collections_to_function_jobs", | ||
| ["function_job_collection_uuid", "function_job_uuid"], | ||
| ) | ||
|
|
||
| op.drop_column("funcapi_function_job_collections_to_function_jobs", "order") | ||
| # ### end Alembic commands ### |
21 changes: 21 additions & 0 deletions
21
...core_postgres_database/migration/versions/f641b3eacafd_merge_06596ce2bc3e_a6289977e057.py
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,21 @@ | ||
| """merge 06596ce2bc3e a6289977e057 | ||
|
|
||
| Revision ID: f641b3eacafd | ||
| Revises: 06596ce2bc3e, a6289977e057 | ||
| Create Date: 2025-10-14 07:10:39.664119+00:00 | ||
|
|
||
| """ | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision = "f641b3eacafd" | ||
| down_revision = ("06596ce2bc3e", "a6289977e057") | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade(): | ||
| pass | ||
|
|
||
|
|
||
| def downgrade(): | ||
| pass |
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
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.