mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
Remove all in-postgres Enums (#637)
This commit is contained in:
parent
c9edc2711c
commit
ca0f186b0e
@ -35,6 +35,7 @@ def upgrade() -> None:
|
||||
"SUCCESS",
|
||||
"FAILED",
|
||||
name="indexingstatus",
|
||||
native_enum=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
|
30
backend/alembic/versions/46625e4745d4_remove_native_enum.py
Normal file
30
backend/alembic/versions/46625e4745d4_remove_native_enum.py
Normal file
@ -0,0 +1,30 @@
|
||||
"""Remove Native Enum
|
||||
|
||||
Revision ID: 46625e4745d4
|
||||
Revises: 9d97fecfab7f
|
||||
Create Date: 2023-10-27 11:38:33.803145
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
from sqlalchemy import String
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "46625e4745d4"
|
||||
down_revision = "9d97fecfab7f"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# At this point, we directly changed some previous migrations,
|
||||
# https://github.com/danswer-ai/danswer/pull/637
|
||||
# Due to using Postgres native Enums, it caused some complications for first time users.
|
||||
# To remove those complications, all Enums are only handled application side moving forward.
|
||||
# This migration exists to ensure that existing users don't run into upgrade issues.
|
||||
op.alter_column("index_attempt", "status", type_=String)
|
||||
op.execute("DROP TYPE IF EXISTS indexingstatus")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# We don't want Native Enums, do nothing
|
||||
pass
|
@ -59,6 +59,7 @@ def upgrade() -> None:
|
||||
"SUCCESS",
|
||||
"FAILED",
|
||||
name="indexingstatus",
|
||||
native_enum=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
@ -70,4 +71,3 @@ def upgrade() -> None:
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("index_attempt")
|
||||
sa.Enum(name="indexingstatus").drop(op.get_bind(), checkfirst=False)
|
||||
|
@ -18,7 +18,6 @@ depends_on = None
|
||||
|
||||
def upgrade() -> None:
|
||||
op.drop_table("deletion_attempt")
|
||||
sa.Enum(name="deletionstatus").drop(op.get_bind(), checkfirst=False)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
|
@ -17,7 +17,6 @@ depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table(
|
||||
"document",
|
||||
sa.Column("id", sa.String(), nullable=False),
|
||||
@ -32,6 +31,7 @@ def upgrade() -> None:
|
||||
"VECTOR",
|
||||
"KEYWORD",
|
||||
name="documentstoretype",
|
||||
native_enum=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
@ -55,6 +55,7 @@ def upgrade() -> None:
|
||||
"SUCCESS",
|
||||
"FAILED",
|
||||
name="deletionstatus",
|
||||
native_enum=False,
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
@ -101,15 +102,10 @@ def upgrade() -> None:
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id", "connector_id", "credential_id"),
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table("document_by_connector_credential_pair")
|
||||
op.drop_table("deletion_attempt")
|
||||
op.drop_table("chunk")
|
||||
op.drop_table("document")
|
||||
sa.Enum(name="deletionstatus").drop(op.get_bind(), checkfirst=False)
|
||||
sa.Enum(name="documentstoretype").drop(op.get_bind(), checkfirst=False)
|
||||
# ### end Alembic commands ###
|
||||
|
Loading…
x
Reference in New Issue
Block a user