forked from danswer-ai/danswer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'danswer-ai:main' into main
- Loading branch information
Showing
46 changed files
with
1,644 additions
and
365 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"""PG File Store | ||
Revision ID: 4738e4b3bae1 | ||
Revises: e91df4e935ef | ||
Create Date: 2024-03-20 18:53:32.461518 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "4738e4b3bae1" | ||
down_revision = "e91df4e935ef" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"file_store", | ||
sa.Column("file_name", sa.String(), nullable=False), | ||
sa.Column("lobj_oid", sa.Integer(), nullable=False), | ||
sa.PrimaryKeyConstraint("file_name"), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_table("file_store") |
71 changes: 71 additions & 0 deletions
71
backend/alembic/versions/776b3bbe9092_remove_remaining_enums.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"""Remove Remaining Enums | ||
Revision ID: 776b3bbe9092 | ||
Revises: 4738e4b3bae1 | ||
Create Date: 2024-03-22 21:34:27.629444 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
from danswer.db.models import IndexModelStatus | ||
from danswer.search.models import RecencyBiasSetting | ||
from danswer.search.models import SearchType | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "776b3bbe9092" | ||
down_revision = "4738e4b3bae1" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.alter_column( | ||
"persona", | ||
"search_type", | ||
type_=sa.String, | ||
existing_type=sa.Enum(SearchType, native_enum=False), | ||
existing_nullable=False, | ||
) | ||
op.alter_column( | ||
"persona", | ||
"recency_bias", | ||
type_=sa.String, | ||
existing_type=sa.Enum(RecencyBiasSetting, native_enum=False), | ||
existing_nullable=False, | ||
) | ||
|
||
# Because the indexmodelstatus enum does not have a mapping to a string type | ||
# we need this workaround instead of directly changing the type | ||
op.add_column("embedding_model", sa.Column("temp_status", sa.String)) | ||
op.execute("UPDATE embedding_model SET temp_status = status::text") | ||
op.drop_column("embedding_model", "status") | ||
op.alter_column("embedding_model", "temp_status", new_column_name="status") | ||
|
||
op.execute("DROP TYPE IF EXISTS searchtype") | ||
op.execute("DROP TYPE IF EXISTS recencybiassetting") | ||
op.execute("DROP TYPE IF EXISTS indexmodelstatus") | ||
|
||
|
||
def downgrade() -> None: | ||
op.alter_column( | ||
"persona", | ||
"search_type", | ||
type_=sa.Enum(SearchType, native_enum=False), | ||
existing_type=sa.String(length=50), | ||
existing_nullable=False, | ||
) | ||
op.alter_column( | ||
"persona", | ||
"recency_bias", | ||
type_=sa.Enum(RecencyBiasSetting, native_enum=False), | ||
existing_type=sa.String(length=50), | ||
existing_nullable=False, | ||
) | ||
op.alter_column( | ||
"embedding_model", | ||
"status", | ||
type_=sa.Enum(IndexModelStatus, native_enum=False), | ||
existing_type=sa.String(length=50), | ||
existing_nullable=False, | ||
) |
36 changes: 36 additions & 0 deletions
36
backend/alembic/versions/91fd3b470d1a_remove_documentsource_from_tag.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Remove DocumentSource from Tag | ||
Revision ID: 91fd3b470d1a | ||
Revises: 173cae5bba26 | ||
Create Date: 2024-03-21 12:05:23.956734 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from danswer.configs.constants import DocumentSource | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "91fd3b470d1a" | ||
down_revision = "173cae5bba26" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.alter_column( | ||
"tag", | ||
"source", | ||
type_=sa.String(length=50), | ||
existing_type=sa.Enum(DocumentSource, native_enum=False), | ||
existing_nullable=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.alter_column( | ||
"tag", | ||
"source", | ||
type_=sa.Enum(DocumentSource, native_enum=False), | ||
existing_type=sa.String(length=50), | ||
existing_nullable=False, | ||
) |
118 changes: 118 additions & 0 deletions
118
backend/alembic/versions/e91df4e935ef_private_personas_documentsets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
"""Private Personas DocumentSets | ||
Revision ID: e91df4e935ef | ||
Revises: 91fd3b470d1a | ||
Create Date: 2024-03-17 11:47:24.675881 | ||
""" | ||
import fastapi_users_db_sqlalchemy | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "e91df4e935ef" | ||
down_revision = "91fd3b470d1a" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"document_set__user", | ||
sa.Column("document_set_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"user_id", | ||
fastapi_users_db_sqlalchemy.generics.GUID(), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["document_set_id"], | ||
["document_set.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], | ||
["user.id"], | ||
), | ||
sa.PrimaryKeyConstraint("document_set_id", "user_id"), | ||
) | ||
op.create_table( | ||
"persona__user", | ||
sa.Column("persona_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"user_id", | ||
fastapi_users_db_sqlalchemy.generics.GUID(), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["persona_id"], | ||
["persona.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_id"], | ||
["user.id"], | ||
), | ||
sa.PrimaryKeyConstraint("persona_id", "user_id"), | ||
) | ||
op.create_table( | ||
"document_set__user_group", | ||
sa.Column("document_set_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"user_group_id", | ||
sa.Integer(), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["document_set_id"], | ||
["document_set.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_group_id"], | ||
["user_group.id"], | ||
), | ||
sa.PrimaryKeyConstraint("document_set_id", "user_group_id"), | ||
) | ||
op.create_table( | ||
"persona__user_group", | ||
sa.Column("persona_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"user_group_id", | ||
sa.Integer(), | ||
nullable=False, | ||
), | ||
sa.ForeignKeyConstraint( | ||
["persona_id"], | ||
["persona.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["user_group_id"], | ||
["user_group.id"], | ||
), | ||
sa.PrimaryKeyConstraint("persona_id", "user_group_id"), | ||
) | ||
|
||
op.add_column( | ||
"document_set", | ||
sa.Column("is_public", sa.Boolean(), nullable=True), | ||
) | ||
# fill in is_public for existing rows | ||
op.execute("UPDATE document_set SET is_public = true WHERE is_public IS NULL") | ||
op.alter_column("document_set", "is_public", nullable=False) | ||
|
||
op.add_column( | ||
"persona", | ||
sa.Column("is_public", sa.Boolean(), nullable=True), | ||
) | ||
# fill in is_public for existing rows | ||
op.execute("UPDATE persona SET is_public = true WHERE is_public IS NULL") | ||
op.alter_column("persona", "is_public", nullable=False) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("persona", "is_public") | ||
|
||
op.drop_column("document_set", "is_public") | ||
|
||
op.drop_table("persona__user") | ||
op.drop_table("document_set__user") | ||
op.drop_table("persona__user_group") | ||
op.drop_table("document_set__user_group") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.