feat: added circleback connector

This commit is contained in:
DESKTOP-RTLN3BA\$punk 2025-12-30 09:00:59 -08:00
parent 23870042f3
commit c19d300c9d
27 changed files with 1153 additions and 97 deletions

View file

@ -57,18 +57,17 @@ def upgrade() -> None:
def downgrade() -> None:
"""Remove 'GOOGLE_DRIVE_CONNECTOR' from enum types.
Note: PostgreSQL doesn't support removing enum values directly.
This would require recreating the enum type, which is complex and risky.
For now, we'll leave the enum values in place.
In a production environment with strict downgrade requirements, you would need to:
1. Create new enum types without the value
2. Convert all columns to use the new type
3. Drop the old enum type
4. Rename the new type to the old name
This is left as pass to avoid accidental data loss.
"""
pass

View file

@ -19,9 +19,9 @@ depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
from sqlalchemy import text
connection = op.get_bind()
connection.execute(
text(
"""
@ -39,9 +39,9 @@ def upgrade() -> None:
"""
)
)
connection.commit()
connection.execute(
text(
"""
@ -51,15 +51,15 @@ def upgrade() -> None:
"""
)
)
connection.commit()
def downgrade() -> None:
from sqlalchemy import text
connection = op.get_bind()
connection.execute(
text(
"""
@ -69,6 +69,5 @@ def downgrade() -> None:
"""
)
)
connection.commit()
connection.commit()

View file

@ -0,0 +1,73 @@
"""Add Circleback connector enums
Revision ID: 56
Revises: 55
Create Date: 2025-12-30 12:00:00.000000
"""
from collections.abc import Sequence
from alembic import op
# revision identifiers, used by Alembic.
revision: str = "56"
down_revision: str | None = "55"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None
def upgrade() -> None:
"""Safely add 'CIRCLEBACK' to documenttype and 'CIRCLEBACK_CONNECTOR' to searchsourceconnectortype enums if missing."""
# Add to documenttype enum
op.execute(
"""
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_type t
JOIN pg_enum e ON t.oid = e.enumtypid
WHERE t.typname = 'documenttype' AND e.enumlabel = 'CIRCLEBACK'
) THEN
ALTER TYPE documenttype ADD VALUE 'CIRCLEBACK';
END IF;
END
$$;
"""
)
# Add to searchsourceconnectortype enum
op.execute(
"""
DO $$
BEGIN
IF NOT EXISTS (
SELECT 1 FROM pg_type t
JOIN pg_enum e ON t.oid = e.enumtypid
WHERE t.typname = 'searchsourceconnectortype' AND e.enumlabel = 'CIRCLEBACK_CONNECTOR'
) THEN
ALTER TYPE searchsourceconnectortype ADD VALUE 'CIRCLEBACK_CONNECTOR';
END IF;
END
$$;
"""
)
def downgrade() -> None:
"""Remove 'CIRCLEBACK' and 'CIRCLEBACK_CONNECTOR' from enum types.
Note: PostgreSQL doesn't support removing enum values directly.
This would require recreating the enum type, which is complex and risky.
For now, we'll leave the enum values in place.
In a production environment with strict downgrade requirements, you would need to:
1. Create new enum types without the value
2. Convert all columns to use the new type
3. Drop the old enum type
4. Rename the new type to the old name
This is left as pass to avoid accidental data loss.
"""
pass