-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New table for wrokflow_tag and topic join
- Loading branch information
1 parent
7060441
commit 73f87ac
Showing
4 changed files
with
82 additions
and
7 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
29 changes: 29 additions & 0 deletions
29
agr_literature_service/api/models/workflow_tag_topic_model.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,29 @@ | ||
from typing import Dict | ||
from agr_literature_service.api.database.base import Base | ||
from agr_literature_service.api.database.versioning import enable_versioning | ||
from agr_literature_service.api.models.audited_model import AuditedModel | ||
from sqlalchemy import (Column, ForeignKey, Integer, String) | ||
from sqlalchemy.orm import relationship | ||
|
||
class WorkflowTagTopicModel(AuditedModel, Base): | ||
__tablename__ = "workflow_tag_topic" | ||
|
||
workflow_tag_topic_id = Column( | ||
Integer, | ||
primary_key=True, | ||
autoincrement=True | ||
) | ||
|
||
workflow_tag = Column( | ||
String(), | ||
index=True, | ||
unique=True, | ||
nullable=False | ||
) | ||
|
||
# Obtained from A-Team ontology node term-id | ||
topic = Column( | ||
String(), | ||
unique=False, | ||
nullable=False | ||
) |
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
45 changes: 45 additions & 0 deletions
45
alembic/versions/20250307_bf8c336530f9_workflow_tag_topic_addition.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,45 @@ | ||
"""workflow_tag_topic addition | ||
Revision ID: bf8c336530f9 | ||
Revises: a286f0a59a44 | ||
Create Date: 2025-03-07 17:00:28.761932 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'bf8c336530f9' | ||
down_revision = 'a286f0a59a44' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('workflow_tag_topic', | ||
sa.Column('workflow_tag_topic_id', sa.Integer(), autoincrement=True, nullable=False), | ||
sa.Column('workflow_tag', sa.String(), nullable=False), | ||
sa.Column('topic', sa.String(), nullable=False), | ||
sa.Column('date_created', sa.DateTime(), nullable=False), | ||
sa.Column('date_updated', sa.DateTime(), nullable=True), | ||
sa.Column('created_by', sa.String(), nullable=True), | ||
sa.Column('updated_by', sa.String(), nullable=True), | ||
sa.ForeignKeyConstraint(['created_by'], ['users.id'], ), | ||
sa.ForeignKeyConstraint(['updated_by'], ['users.id'], ), | ||
sa.PrimaryKeyConstraint('workflow_tag_topic_id') | ||
) | ||
op.create_index(op.f('ix_workflow_tag_topic_date_created'), 'workflow_tag_topic', ['date_created'], unique=False) | ||
op.create_index(op.f('ix_workflow_tag_topic_date_updated'), 'workflow_tag_topic', ['date_updated'], unique=False) | ||
op.create_index(op.f('ix_workflow_tag_topic_workflow_tag'), 'workflow_tag_topic', ['workflow_tag'], unique=True) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_workflow_tag_topic_workflow_tag'), table_name='workflow_tag_topic') | ||
op.drop_index(op.f('ix_workflow_tag_topic_date_updated'), table_name='workflow_tag_topic') | ||
op.drop_index(op.f('ix_workflow_tag_topic_date_created'), table_name='workflow_tag_topic') | ||
op.drop_table('workflow_tag_topic') | ||
# ### end Alembic commands ### |