diff --git a/crc/api.yml b/crc/api.yml index a186cbcf..46b8437a 100644 --- a/crc/api.yml +++ b/crc/api.yml @@ -894,6 +894,8 @@ components: type: string display_name: type: string + display_order: + type: integer File: properties: id: diff --git a/crc/models/workflow.py b/crc/models/workflow.py index 00c63231..82cd0b73 100644 --- a/crc/models/workflow.py +++ b/crc/models/workflow.py @@ -12,6 +12,7 @@ class WorkflowSpecCategoryModel(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String) display_name = db.Column(db.String) + display_order = db.Column(db.Integer) class WorkflowSpecCategoryModelSchema(SQLAlchemyAutoSchema): diff --git a/migrations/versions/5e0709e172fa_.py b/migrations/versions/5e0709e172fa_.py new file mode 100644 index 00000000..31ac2eeb --- /dev/null +++ b/migrations/versions/5e0709e172fa_.py @@ -0,0 +1,28 @@ +"""empty message + +Revision ID: 5e0709e172fa +Revises: ddd5fc9ea75b +Create Date: 2020-03-26 14:05:06.607043 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = '5e0709e172fa' +down_revision = 'ddd5fc9ea75b' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('workflow_spec_category', sa.Column('display_order', sa.Integer(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('workflow_spec_category', 'display_order') + # ### end Alembic commands ### diff --git a/tests/test_workflow_spec_api.py b/tests/test_workflow_spec_api.py index 5bb7c71c..e8ca31bd 100644 --- a/tests/test_workflow_spec_api.py +++ b/tests/test_workflow_spec_api.py @@ -49,7 +49,7 @@ class TestWorkflowSpec(BaseTest): def test_update_workflow_specification(self): self.load_example_data() - category = WorkflowSpecCategoryModel(id=0, name='trap', display_name="It's a trap!") + category = WorkflowSpecCategoryModel(id=0, name='trap', display_name="It's a trap!", display_order=0) session.add(category) session.commit() @@ -71,6 +71,7 @@ class TestWorkflowSpec(BaseTest): self.assertIsNotNone(db_spec_after.workflow_spec_category_id) self.assertIsNotNone(db_spec_after.workflow_spec_category) self.assertEqual(db_spec_after.workflow_spec_category.display_name, category.display_name) + self.assertEqual(db_spec_after.workflow_spec_category.display_order, category.display_order) def test_delete_workflow_specification(self): self.load_example_data()