Record of alembic revision noise at the current commit

Ideally, this migration should be empty
This commit is contained in:
danswer-trial 2024-09-11 14:11:01 -07:00
parent eda4108d20
commit 00ea2dcd85

View File

@ -0,0 +1,302 @@
"""alembic noise
Revision ID: 0fd9b9254c3c
Revises: 52a219fb5233
Create Date: 2024-09-11 14:03:05.593096
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "0fd9b9254c3c"
down_revision = "52a219fb5233"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"chat_message__standard_answer",
sa.Column("chat_message_id", sa.Integer(), nullable=False),
sa.Column("standard_answer_id", sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(
["chat_message_id"],
["chat_message.id"],
),
sa.ForeignKeyConstraint(
["standard_answer_id"],
["standard_answer.id"],
),
sa.PrimaryKeyConstraint("chat_message_id", "standard_answer_id"),
)
op.create_table(
"celery_taskmeta",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("task_id", sa.String(length=155), nullable=True),
sa.Column("status", sa.String(length=50), nullable=True),
sa.Column("result", sa.PickleType(), nullable=True),
sa.Column("date_done", sa.DateTime(), nullable=True),
sa.Column("traceback", sa.Text(), nullable=True),
sa.Column("name", sa.String(length=155), nullable=True),
sa.Column("args", sa.LargeBinary(), nullable=True),
sa.Column("kwargs", sa.LargeBinary(), nullable=True),
sa.Column("worker", sa.String(length=155), nullable=True),
sa.Column("retries", sa.Integer(), nullable=True),
sa.Column("queue", sa.String(length=155), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("task_id"),
sqlite_autoincrement=True,
)
op.create_table(
"celery_tasksetmeta",
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column("taskset_id", sa.String(length=155), nullable=True),
sa.Column("result", sa.PickleType(), nullable=True),
sa.Column("date_done", sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint("id"),
sa.UniqueConstraint("taskset_id"),
sqlite_autoincrement=True,
)
op.create_foreign_key(None, "api_key", "user", ["owner_id"], ["id"])
op.create_foreign_key(None, "api_key", "user", ["user_id"], ["id"])
op.alter_column(
"chat_folder",
"display_priority",
existing_type=sa.INTEGER(),
nullable=True,
)
op.drop_constraint("chat_message_id_key", "chat_message", type_="unique")
op.alter_column(
"credential",
"source",
existing_type=sa.VARCHAR(length=100),
nullable=False,
)
op.alter_column(
"credential",
"credential_json",
existing_type=postgresql.BYTEA(),
nullable=False,
)
op.drop_index(
"ix_document_by_connector_credential_pair_pkey__connecto_27dc",
table_name="document_by_connector_credential_pair",
)
op.alter_column(
"document_set__user", "user_id", existing_type=sa.UUID(), nullable=True
)
op.add_column(
"email_to_external_user_cache",
sa.Column(
"source_type",
sa.Enum(
"INGESTION_API",
"SLACK",
"WEB",
"GOOGLE_DRIVE",
"GMAIL",
"REQUESTTRACKER",
"GITHUB",
"GITLAB",
"GURU",
"BOOKSTACK",
"CONFLUENCE",
"SLAB",
"JIRA",
"PRODUCTBOARD",
"FILE",
"NOTION",
"ZULIP",
"LINEAR",
"HUBSPOT",
"DOCUMENT360",
"GONG",
"GOOGLE_SITES",
"ZENDESK",
"LOOPIO",
"DROPBOX",
"SHAREPOINT",
"TEAMS",
"SALESFORCE",
"DISCOURSE",
"AXERO",
"CLICKUP",
"MEDIAWIKI",
"WIKIPEDIA",
"S3",
"R2",
"GOOGLE_CLOUD_STORAGE",
"OCI_STORAGE",
"NOT_APPLICABLE",
name="documentsource",
native_enum=False,
),
nullable=False,
),
)
op.alter_column(
"inputprompt__user",
"user_id",
existing_type=sa.INTEGER(),
nullable=True,
)
op.alter_column(
"llm_provider", "provider", existing_type=sa.VARCHAR(), nullable=False
)
op.alter_column("persona__user", "user_id", existing_type=sa.UUID(), nullable=True)
op.alter_column(
"saml",
"expires_at",
existing_type=postgresql.TIMESTAMP(timezone=True),
nullable=False,
)
op.alter_column(
"search_settings",
"query_prefix",
existing_type=sa.VARCHAR(),
nullable=True,
)
op.alter_column(
"search_settings",
"passage_prefix",
existing_type=sa.VARCHAR(),
nullable=True,
)
op.alter_column(
"search_settings", "status", existing_type=sa.VARCHAR(), nullable=False
)
op.create_index(
"ix_embedding_model_future_unique",
"search_settings",
["status"],
unique=True,
postgresql_where=sa.text("status = 'FUTURE'"),
)
op.create_index(
"ix_embedding_model_present_unique",
"search_settings",
["status"],
unique=True,
postgresql_where=sa.text("status = 'PRESENT'"),
)
op.drop_constraint("standard_answer_keyword_key", "standard_answer", type_="unique")
op.create_index(
"unique_keyword_active",
"standard_answer",
["keyword", "active"],
unique=True,
postgresql_where=sa.text("active = true"),
)
op.alter_column(
"tool_call",
"tool_result",
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=True,
)
op.alter_column(
"user__user_group", "user_id", existing_type=sa.UUID(), nullable=True
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"user__user_group", "user_id", existing_type=sa.UUID(), nullable=False
)
op.alter_column(
"tool_call",
"tool_result",
existing_type=postgresql.JSONB(astext_type=sa.Text()),
nullable=False,
)
op.drop_index(
"unique_keyword_active",
table_name="standard_answer",
postgresql_where=sa.text("active = true"),
)
op.create_unique_constraint(
"standard_answer_keyword_key", "standard_answer", ["keyword"]
)
op.drop_index(
"ix_embedding_model_present_unique",
table_name="search_settings",
postgresql_where=sa.text("status = 'PRESENT'"),
)
op.drop_index(
"ix_embedding_model_future_unique",
table_name="search_settings",
postgresql_where=sa.text("status = 'FUTURE'"),
)
op.alter_column(
"search_settings", "status", existing_type=sa.VARCHAR(), nullable=True
)
op.alter_column(
"search_settings",
"passage_prefix",
existing_type=sa.VARCHAR(),
nullable=False,
)
op.alter_column(
"search_settings",
"query_prefix",
existing_type=sa.VARCHAR(),
nullable=False,
)
op.alter_column(
"saml",
"expires_at",
existing_type=postgresql.TIMESTAMP(timezone=True),
nullable=True,
)
op.alter_column("persona__user", "user_id", existing_type=sa.UUID(), nullable=False)
op.alter_column(
"llm_provider", "provider", existing_type=sa.VARCHAR(), nullable=True
)
op.alter_column(
"inputprompt__user",
"user_id",
existing_type=sa.INTEGER(),
nullable=False,
)
op.drop_column("email_to_external_user_cache", "source_type")
op.alter_column(
"document_set__user",
"user_id",
existing_type=sa.UUID(),
nullable=False,
)
op.create_index(
"ix_document_by_connector_credential_pair_pkey__connecto_27dc",
"document_by_connector_credential_pair",
["connector_id", "credential_id"],
unique=False,
)
op.alter_column(
"credential",
"credential_json",
existing_type=postgresql.BYTEA(),
nullable=True,
)
op.alter_column(
"credential",
"source",
existing_type=sa.VARCHAR(length=100),
nullable=True,
)
op.create_unique_constraint("chat_message_id_key", "chat_message", ["id"])
op.alter_column(
"chat_folder",
"display_priority",
existing_type=sa.INTEGER(),
nullable=False,
)
op.drop_constraint(None, "api_key", type_="foreignkey")
op.drop_constraint(None, "api_key", type_="foreignkey")
op.drop_table("celery_tasksetmeta")
op.drop_table("celery_taskmeta")
op.drop_table("chat_message__standard_answer")
# ### end Alembic commands ###