-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
* tests: adapt tests to new implementation of jobs registry * chore: fix formatting
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# | ||
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.9, postgresql14, opensearch2)
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.9, postgresql14, opensearch2)
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.9, postgresql14, opensearch2)
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.12, postgresql14, opensearch2)
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.12, postgresql14, opensearch2)
Check failure on line 1 in invenio_jobs/alembic/1f896f6990b8_update_jobs_module_table_names.py GitHub Actions / Tests / Tests (3.12, postgresql14, opensearch2)
|
||
# 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""" | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
from sqlalchemy_utils import JSONType, UUIDType, ChoiceType | ||
|
||
# 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']) | ||
|
||
# ### 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']) | ||
# ### end Alembic commands ### |
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 |