-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/danswer-ai/danswer into bug…
…fix/beat_redux # Conflicts: # backend/onyx/background/celery/tasks/indexing/tasks.py
- Loading branch information
Showing
59 changed files
with
2,200 additions
and
321 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
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
36 changes: 36 additions & 0 deletions
36
backend/alembic/versions/0f7ff6d75b57_add_index_to_index_attempt_time_created.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 @@ | ||
"""add index to index_attempt.time_created | ||
Revision ID: 0f7ff6d75b57 | ||
Revises: 369644546676 | ||
Create Date: 2025-01-10 14:01:14.067144 | ||
""" | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "0f7ff6d75b57" | ||
down_revision = "fec3db967bf7" | ||
branch_labels: None = None | ||
depends_on: None = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index( | ||
op.f("ix_index_attempt_status"), | ||
"index_attempt", | ||
["status"], | ||
unique=False, | ||
) | ||
|
||
op.create_index( | ||
op.f("ix_index_attempt_time_created"), | ||
"index_attempt", | ||
["time_created"], | ||
unique=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index(op.f("ix_index_attempt_time_created"), table_name="index_attempt") | ||
|
||
op.drop_index(op.f("ix_index_attempt_status"), table_name="index_attempt") |
35 changes: 35 additions & 0 deletions
35
backend/alembic/versions/369644546676_add_composite_index_for_index_attempt_.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,35 @@ | ||
"""add composite index for index attempt time updated | ||
Revision ID: 369644546676 | ||
Revises: 2955778aa44c | ||
Create Date: 2025-01-08 15:38:17.224380 | ||
""" | ||
from alembic import op | ||
from sqlalchemy import text | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "369644546676" | ||
down_revision = "2955778aa44c" | ||
branch_labels: None = None | ||
depends_on: None = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index( | ||
"ix_index_attempt_ccpair_search_settings_time_updated", | ||
"index_attempt", | ||
[ | ||
"connector_credential_pair_id", | ||
"search_settings_id", | ||
text("time_updated DESC"), | ||
], | ||
unique=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index( | ||
"ix_index_attempt_ccpair_search_settings_time_updated", | ||
table_name="index_attempt", | ||
) |
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,72 @@ | ||
"""Add SyncRecord | ||
Revision ID: 97dbb53fa8c8 | ||
Revises: 369644546676 | ||
Create Date: 2025-01-11 19:39:50.426302 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "97dbb53fa8c8" | ||
down_revision = "be2ab2aa50ee" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_table( | ||
"sync_record", | ||
sa.Column("id", sa.Integer(), nullable=False), | ||
sa.Column("entity_id", sa.Integer(), nullable=False), | ||
sa.Column( | ||
"sync_type", | ||
sa.Enum( | ||
"DOCUMENT_SET", | ||
"USER_GROUP", | ||
"CONNECTOR_DELETION", | ||
name="synctype", | ||
native_enum=False, | ||
length=40, | ||
), | ||
nullable=False, | ||
), | ||
sa.Column( | ||
"sync_status", | ||
sa.Enum( | ||
"IN_PROGRESS", | ||
"SUCCESS", | ||
"FAILED", | ||
"CANCELED", | ||
name="syncstatus", | ||
native_enum=False, | ||
length=40, | ||
), | ||
nullable=False, | ||
), | ||
sa.Column("num_docs_synced", sa.Integer(), nullable=False), | ||
sa.Column("sync_start_time", sa.DateTime(timezone=True), nullable=False), | ||
sa.Column("sync_end_time", sa.DateTime(timezone=True), nullable=True), | ||
sa.PrimaryKeyConstraint("id"), | ||
) | ||
|
||
# Add index for fetch_latest_sync_record query | ||
op.create_index( | ||
"ix_sync_record_entity_id_sync_type_sync_start_time", | ||
"sync_record", | ||
["entity_id", "sync_type", "sync_start_time"], | ||
) | ||
|
||
# Add index for cleanup_sync_records query | ||
op.create_index( | ||
"ix_sync_record_entity_id_sync_type_sync_status", | ||
"sync_record", | ||
["entity_id", "sync_type", "sync_status"], | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index("ix_sync_record_entity_id_sync_type_sync_status") | ||
op.drop_index("ix_sync_record_entity_id_sync_type_sync_start_time") | ||
op.drop_table("sync_record") |
38 changes: 38 additions & 0 deletions
38
backend/alembic/versions/be2ab2aa50ee_fix_capitalization.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,38 @@ | ||
"""fix_capitalization | ||
Revision ID: be2ab2aa50ee | ||
Revises: 369644546676 | ||
Create Date: 2025-01-10 13:13:26.228960 | ||
""" | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "be2ab2aa50ee" | ||
down_revision = "369644546676" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.execute( | ||
""" | ||
UPDATE document | ||
SET | ||
external_user_group_ids = ARRAY( | ||
SELECT LOWER(unnest(external_user_group_ids)) | ||
), | ||
last_modified = NOW() | ||
WHERE | ||
external_user_group_ids IS NOT NULL | ||
AND external_user_group_ids::text[] <> ARRAY( | ||
SELECT LOWER(unnest(external_user_group_ids)) | ||
)::text[] | ||
""" | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
# No way to cleanly persist the bad state through an upgrade/downgrade | ||
# cycle, so we just pass | ||
pass |
41 changes: 41 additions & 0 deletions
41
backend/alembic/versions/fec3db967bf7_add_time_updated_to_usergroup_and_.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,41 @@ | ||
"""Add time_updated to UserGroup and DocumentSet | ||
Revision ID: fec3db967bf7 | ||
Revises: 97dbb53fa8c8 | ||
Create Date: 2025-01-12 15:49:02.289100 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "fec3db967bf7" | ||
down_revision = "97dbb53fa8c8" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"document_set", | ||
sa.Column( | ||
"time_last_modified_by_user", | ||
sa.DateTime(timezone=True), | ||
nullable=False, | ||
server_default=sa.func.now(), | ||
), | ||
) | ||
op.add_column( | ||
"user_group", | ||
sa.Column( | ||
"time_last_modified_by_user", | ||
sa.DateTime(timezone=True), | ||
nullable=False, | ||
server_default=sa.func.now(), | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("user_group", "time_last_modified_by_user") | ||
op.drop_column("document_set", "time_last_modified_by_user") |
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.