-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path150ac8a20e59_change_schema.py
More file actions
63 lines (56 loc) · 3.56 KB
/
150ac8a20e59_change_schema.py
File metadata and controls
63 lines (56 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"""change schema
Revision ID: 150ac8a20e59
Revises: 7334713b30a6
Create Date: 2025-07-29 12:44:15.804586
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '150ac8a20e59'
down_revision = '7334713b30a6'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('sharepoint_property_sync',
sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
sa.Column('created_by', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('created_at', sa.DateTime(), nullable=True),
sa.Column('updated_at', sa.DateTime(), nullable=True),
sa.Column('integration_id', postgresql.UUID(as_uuid=True), nullable=True),
sa.Column('config', sa.JSON(), nullable=True),
sa.Column('logs', sa.ARRAY(sa.String()), nullable=True),
sa.Column('state', sa.String(), nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['user.id'], ondelete='SET NULL'),
sa.ForeignKeyConstraint(['integration_id'], ['cognition.integration.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id'),
schema='integration'
)
op.create_index(op.f('ix_integration_sharepoint_property_sync_created_by'), 'sharepoint_property_sync', ['created_by'], unique=False, schema='integration')
op.create_index(op.f('ix_integration_sharepoint_property_sync_integration_id'), 'sharepoint_property_sync', ['integration_id'], unique=False, schema='integration')
op.drop_index('ix_sharepoint_property_sync_created_by', table_name='sharepoint_property_sync')
op.drop_index('ix_sharepoint_property_sync_integration_id', table_name='sharepoint_property_sync')
op.drop_table('sharepoint_property_sync')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('sharepoint_property_sync',
sa.Column('id', postgresql.UUID(), autoincrement=False, nullable=False),
sa.Column('created_by', postgresql.UUID(), autoincrement=False, nullable=True),
sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
sa.Column('integration_id', postgresql.UUID(), autoincrement=False, nullable=True),
sa.Column('config', postgresql.JSON(astext_type=sa.Text()), autoincrement=False, nullable=True),
sa.Column('logs', postgresql.ARRAY(sa.VARCHAR()), autoincrement=False, nullable=True),
sa.Column('state', sa.VARCHAR(), autoincrement=False, nullable=True),
sa.ForeignKeyConstraint(['created_by'], ['user.id'], name='sharepoint_property_sync_created_by_fkey', ondelete='SET NULL'),
sa.ForeignKeyConstraint(['integration_id'], ['cognition.integration.id'], name='sharepoint_property_sync_integration_id_fkey', ondelete='CASCADE'),
sa.PrimaryKeyConstraint('id', name='sharepoint_property_sync_pkey')
)
op.create_index('ix_sharepoint_property_sync_integration_id', 'sharepoint_property_sync', ['integration_id'], unique=False)
op.create_index('ix_sharepoint_property_sync_created_by', 'sharepoint_property_sync', ['created_by'], unique=False)
op.drop_index(op.f('ix_integration_sharepoint_property_sync_integration_id'), table_name='sharepoint_property_sync', schema='integration')
op.drop_index(op.f('ix_integration_sharepoint_property_sync_created_by'), table_name='sharepoint_property_sync', schema='integration')
op.drop_table('sharepoint_property_sync', schema='integration')
# ### end Alembic commands ###