-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds version tables * Remove organization id * fix alembic * submodule & hotfix * Adds change * Alembic for fkey remove * Submodule change * Submodule merge
- Loading branch information
1 parent
0d61cb2
commit f2f0c1e
Showing
2 changed files
with
53 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
"""Pipeline Version table | ||
Revision ID: 89a5f2211130 | ||
Revises: 2c0029684bd7 | ||
Create Date: 2024-11-21 14:23:59.233725 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.dialects import postgresql | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '89a5f2211130' | ||
down_revision = '2c0029684bd7' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table('pipeline_version', | ||
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), | ||
sa.Column('project_id', postgresql.UUID(as_uuid=True), nullable=True), | ||
sa.Column('name', sa.String(), nullable=True), | ||
sa.Column('version_type', sa.String(), nullable=True), | ||
sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True), | ||
sa.Column('created_at', sa.DateTime(), nullable=True), | ||
sa.Column('pipeline_dump', sa.JSON(), nullable=True), | ||
sa.ForeignKeyConstraint(['created_by'], ['user.id'], ondelete='SET NULL'), | ||
sa.ForeignKeyConstraint(['project_id'], ['cognition.project.id'], ondelete='CASCADE'), | ||
sa.PrimaryKeyConstraint('id'), | ||
schema='cognition' | ||
) | ||
op.create_index(op.f('ix_cognition_pipeline_version_created_by'), 'pipeline_version', ['created_by'], unique=False, schema='cognition') | ||
op.create_index(op.f('ix_cognition_pipeline_version_project_id'), 'pipeline_version', ['project_id'], unique=False, schema='cognition') | ||
op.add_column('message', sa.Column('version_id', postgresql.UUID(as_uuid=True), nullable=True), schema='cognition') | ||
op.create_index(op.f('ix_cognition_message_version_id'), 'message', ['version_id'], unique=False, schema='cognition') | ||
op.create_foreign_key(None, 'message', 'pipeline_version', ['version_id'], ['id'], source_schema='cognition', referent_schema='cognition', ondelete='SET NULL') | ||
op.drop_constraint('pipeline_logs_strategy_step_id_fkey', 'pipeline_logs', schema='cognition', type_='foreignkey') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint(None, 'message', schema='cognition', type_='foreignkey') | ||
op.drop_index(op.f('ix_cognition_message_version_id'), table_name='message', schema='cognition') | ||
op.drop_column('message', 'version_id', schema='cognition') | ||
op.drop_index(op.f('ix_cognition_pipeline_version_project_id'), table_name='pipeline_version', schema='cognition') | ||
op.drop_index(op.f('ix_cognition_pipeline_version_created_by'), table_name='pipeline_version', schema='cognition') | ||
op.drop_table('pipeline_version', schema='cognition') | ||
op.create_foreign_key('pipeline_logs_strategy_step_id_fkey', 'pipeline_logs', 'strategy_step', ['strategy_step_id'], ['id'], source_schema='cognition', referent_schema='cognition', ondelete='CASCADE') | ||
# ### end Alembic commands ### |
Submodule model
updated
6 files
+34 −2 | cognition_objects/message.py | |
+99 −0 | cognition_objects/pipeline_version.py | |
+9 −0 | cognition_objects/strategy.py | |
+2 −0 | cognition_objects/strategy_step.py | |
+8 −0 | enums.py | |
+33 −3 | models.py |