-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,193 additions
and
132 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
69 changes: 69 additions & 0 deletions
69
...axy/model/migrations/alembic/versions_gxy/7ffd33d5d144_implement_structured_tool_state.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,69 @@ | ||
"""implement structured tool state | ||
Revision ID: 7ffd33d5d144 | ||
Revises: eee9229a9765 | ||
Create Date: 2022-11-09 15:53:11.451185 | ||
""" | ||
|
||
from sqlalchemy import ( | ||
Column, | ||
ForeignKey, | ||
Integer, | ||
String, | ||
) | ||
|
||
from galaxy.model.custom_types import JSONType | ||
from galaxy.model.database_object_names import build_index_name | ||
from galaxy.model.migrations.util import ( | ||
_is_sqlite, | ||
add_column, | ||
create_table, | ||
drop_column, | ||
drop_index, | ||
drop_table, | ||
transaction, | ||
) | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "7ffd33d5d144" | ||
down_revision = "eee9229a9765" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
job_table_name = "job" | ||
request_column_name = "tool_request_id" | ||
job_request_index_name = build_index_name(job_table_name, request_column_name) | ||
|
||
|
||
def upgrade(): | ||
with transaction(): | ||
create_table( | ||
"tool_source", | ||
Column("id", Integer, primary_key=True), | ||
Column("hash", String(255), index=True), | ||
Column("source", JSONType), | ||
) | ||
create_table( | ||
"tool_request", | ||
Column("id", Integer, primary_key=True), | ||
Column("request", JSONType), | ||
Column("state", String(32)), | ||
Column("state_message", JSONType), | ||
Column("tool_source_id", Integer, ForeignKey("tool_source.id"), index=True), | ||
Column("history_id", Integer, ForeignKey("history.id"), index=True), | ||
) | ||
index = not _is_sqlite() | ||
add_column( | ||
job_table_name, | ||
Column(request_column_name, Integer, ForeignKey("tool_request.id"), default=None, index=index), | ||
) | ||
|
||
|
||
def downgrade(): | ||
with transaction(): | ||
if not _is_sqlite(): | ||
drop_index(job_request_index_name, job_table_name) | ||
drop_column(job_table_name, request_column_name) | ||
drop_table("tool_request") | ||
drop_table("tool_source") |
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
Oops, something went wrong.