mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-08 20:15:12 +02:00
Setup Postgres to docker compose + add web indexing APIs + update background runner to look for web indices to run (#13)
* Adding Postgres to docker compose * Model / migrations for indexing logs
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
"""Create IndexAttempt table
|
||||
|
||||
Revision ID: 47433d30de82
|
||||
Revises:
|
||||
Create Date: 2023-05-04 00:55:32.971991
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import postgresql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "47433d30de82"
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"index_attempt",
|
||||
sa.Column("id", sa.Integer(), nullable=False),
|
||||
# String type since python enum will change often
|
||||
sa.Column(
|
||||
"source",
|
||||
sa.String(),
|
||||
nullable=False,
|
||||
),
|
||||
# String type to easily accomodate new ways of pulling
|
||||
# in documents
|
||||
sa.Column(
|
||||
"input_type",
|
||||
sa.String(),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"connector_specific_config",
|
||||
postgresql.JSONB(),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column(
|
||||
"time_created",
|
||||
sa.DateTime(timezone=True),
|
||||
server_default=sa.text("now()"),
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column(
|
||||
"time_updated",
|
||||
sa.DateTime(timezone=True),
|
||||
server_onupdate=sa.text("now()"), # type: ignore
|
||||
nullable=True,
|
||||
),
|
||||
sa.Column(
|
||||
"status",
|
||||
sa.Enum(
|
||||
"NOT_STARTED",
|
||||
"IN_PROGRESS",
|
||||
"SUCCESS",
|
||||
"FAILED",
|
||||
name="indexingstatus",
|
||||
),
|
||||
nullable=False,
|
||||
),
|
||||
sa.Column("document_ids", postgresql.ARRAY(sa.String()), nullable=True),
|
||||
sa.Column("error_msg", sa.String(), nullable=True),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_table("index_attempt")
|
||||
sa.Enum(name="indexingstatus").drop(op.get_bind(), checkfirst=False)
|
Reference in New Issue
Block a user