mirror of
https://github.com/MODSetter/SurfSense.git
synced 2025-09-01 01:59:06 +00:00
fix linkup enum migration file
This commit is contained in:
parent
d70ebf9669
commit
24dff5f875
1 changed files with 16 additions and 18 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
Revision ID: 4
|
||||
Revises: 3
|
||||
|
||||
Create Date: 2025-08-13
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
@ -17,31 +17,29 @@ depends_on: str | Sequence[str] | None = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
# Manually add the command to add the enum value
|
||||
op.execute("ALTER TYPE searchsourceconnectortype ADD VALUE 'LINKUP_API'")
|
||||
|
||||
# Pass for the rest, as autogenerate didn't run to add other schema details
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
# Add enum value only if it doesn't already exist.
|
||||
# Postgres will no-op with a NOTICE when the value is present.
|
||||
op.execute(
|
||||
"ALTER TYPE searchsourceconnectortype ADD VALUE IF NOT EXISTS 'LINKUP_API'"
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
|
||||
# Downgrading removal of an enum value requires recreating the type
|
||||
# To "remove" an enum value in Postgres, we must recreate the type
|
||||
# without that value, migrate the column, then drop the old type.
|
||||
op.execute(
|
||||
"ALTER TYPE searchsourceconnectortype RENAME TO searchsourceconnectortype_old"
|
||||
)
|
||||
op.execute(
|
||||
"CREATE TYPE searchsourceconnectortype AS ENUM('SERPER_API', 'TAVILY_API', 'SLACK_CONNECTOR', 'NOTION_CONNECTOR', 'GITHUB_CONNECTOR', 'LINEAR_CONNECTOR')"
|
||||
"CREATE TYPE searchsourceconnectortype AS ENUM("
|
||||
"'SERPER_API', 'TAVILY_API', 'SLACK_CONNECTOR', "
|
||||
"'NOTION_CONNECTOR', 'GITHUB_CONNECTOR', 'LINEAR_CONNECTOR'"
|
||||
")"
|
||||
)
|
||||
op.execute(
|
||||
"ALTER TABLE search_source_connectors ALTER COLUMN connector_type TYPE searchsourceconnectortype USING "
|
||||
"connector_type::text::searchsourceconnectortype"
|
||||
"ALTER TABLE search_source_connectors "
|
||||
"ALTER COLUMN connector_type "
|
||||
"TYPE searchsourceconnectortype "
|
||||
"USING connector_type::text::searchsourceconnectortype"
|
||||
)
|
||||
op.execute("DROP TYPE searchsourceconnectortype_old")
|
||||
|
||||
pass
|
||||
# ### end Alembic commands ###
|
||||
|
|
Loading…
Add table
Reference in a new issue