-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
alembic: change jobs table names for consistency
* tests: adapt tests to new implementation of jobs registry * chore: fix formatting
- Loading branch information
Showing
31 changed files
with
323 additions
and
349 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
59 changes: 59 additions & 0 deletions
59
invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.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,59 @@ | ||
# | ||
# This file is part of Invenio. | ||
# Copyright (C) 2016-2018 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. | ||
|
||
"""Update jobs module table names.""" | ||
|
||
import sqlalchemy as sa | ||
import sqlalchemy_utils | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1f896f6990b8" | ||
down_revision = "356496a01197" | ||
branch_labels = () | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
"""Upgrade database.""" | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint("fk_run_job_id_job", "run", type_="foreignkey") | ||
op.rename_table("job", "jobs_job") | ||
op.rename_table("run", "jobs_run") | ||
|
||
op.create_foreign_key( | ||
"fk_jobs_run_job_id_jobs_job", "jobs_run", "jobs_job", ["job_id"], ["id"] | ||
) | ||
op.drop_column("jobs_job", "default_args") | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
"""Downgrade database.""" | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint("fk_jobs_run_job_id_jobs_job", "jobs_run", type_="foreignkey") | ||
|
||
op.rename_table("jobs_job", "job") | ||
op.rename_table("jobs_run", "run") | ||
op.create_foreign_key("fk_run_job_id_job", "run", "job", ["job_id"], ["id"]) | ||
op.add_column( | ||
"job", | ||
sa.Column( | ||
"default_args", | ||
sa.JSON() | ||
.with_variant(sqlalchemy_utils.types.json.JSONType(), "mysql") | ||
.with_variant( | ||
postgresql.JSONB(none_as_null=True, astext_type=sa.Text()), "postgresql" | ||
) | ||
.with_variant(sqlalchemy_utils.types.json.JSONType(), "sqlite"), | ||
nullable=True, | ||
), | ||
) | ||
|
||
# ### end Alembic commands ### |
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,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2024 CERN. | ||
# | ||
# Invenio-Jobs is free software; you can redistribute it and/or modify it | ||
# under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
"""Record class mock.""" | ||
|
||
|
||
class AttrDict(dict): | ||
"""Mock record class.""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""Constructor.""" | ||
super(AttrDict, self).__init__(*args, **kwargs) | ||
self.__dict__ = self |
6 changes: 6 additions & 0 deletions
6
invenio_jobs/assets/semantic-ui/js/invenio_jobs/administration/JobActions.js
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
8 changes: 7 additions & 1 deletion
8
invenio_jobs/assets/semantic-ui/js/invenio_jobs/administration/RunActionForm.js
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
145 changes: 0 additions & 145 deletions
145
invenio_jobs/assets/semantic-ui/js/invenio_jobs/administration/RunButton.js
This file was deleted.
Oops, something went wrong.
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
6 changes: 6 additions & 0 deletions
6
invenio_jobs/assets/semantic-ui/js/invenio_jobs/administration/ScheduleJobModal.js
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
6 changes: 6 additions & 0 deletions
6
invenio_jobs/assets/semantic-ui/js/invenio_jobs/administration/StatusFormatter.js
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
Oops, something went wrong.