- Finalisation of the Specialist model, forms and views

This commit is contained in:
Josako
2024-11-04 11:22:40 +01:00
parent 503ea7965d
commit 55a8a95f79
16 changed files with 430 additions and 15 deletions

View File

@@ -0,0 +1,29 @@
"""Update Retriever Arguments
Revision ID: 03385f2000da
Revises: e476c2013352
Create Date: 2024-11-04 08:33:46.158354
"""
from alembic import op
import sqlalchemy as sa
import pgvector
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '03385f2000da'
down_revision = 'e476c2013352'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('retriever', sa.Column('arguments', postgresql.JSONB(astext_type=sa.Text()), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('retriever', 'arguments')
# ### end Alembic commands ###

View File

@@ -0,0 +1,35 @@
"""Specialist name to 50 characters
Revision ID: 0c347651837c
Revises: 03385f2000da
Create Date: 2024-11-04 09:25:17.476384
"""
from alembic import op
import sqlalchemy as sa
import pgvector
# revision identifiers, used by Alembic.
revision = '0c347651837c'
down_revision = '03385f2000da'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('specialist', 'name',
existing_type=sa.VARCHAR(length=20),
type_=sa.String(length=50),
existing_nullable=False)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('specialist', 'name',
existing_type=sa.String(length=50),
type_=sa.VARCHAR(length=20),
existing_nullable=False)
# ### end Alembic commands ###

View File

@@ -0,0 +1,52 @@
"""Introducing Specialists
Revision ID: e476c2013352
Revises: 331f8100eb87
Create Date: 2024-11-04 08:08:19.737409
"""
from alembic import op
import sqlalchemy as sa
import pgvector
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'e476c2013352'
down_revision = '331f8100eb87'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('specialist',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('name', sa.String(length=20), nullable=False),
sa.Column('description', sa.Text(), nullable=True),
sa.Column('type', sa.String(length=50), nullable=False),
sa.Column('tuning', sa.Boolean(), nullable=True),
sa.Column('configuration', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('arguments', postgresql.JSONB(astext_type=sa.Text()), nullable=True),
sa.Column('created_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('created_by', sa.Integer(), nullable=True),
sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated_by', sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['public.user.id'], ),
sa.ForeignKeyConstraint(['updated_by'], ['public.user.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_table('specialist_retriever',
sa.Column('specialist_id', sa.Integer(), nullable=False),
sa.Column('retriever_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['retriever_id'], ['retriever.id'], ondelete='CASCADE'),
sa.ForeignKeyConstraint(['specialist_id'], ['specialist.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('specialist_id', 'retriever_id')
)
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('specialist_retriever')
op.drop_table('specialist')
# ### end Alembic commands ###