mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
refactor: remove report_status enum and related index from reports table migration
This commit is contained in:
parent
b6c0406d10
commit
6fc5dc224b
2 changed files with 1 additions and 39 deletions
|
|
@ -4,7 +4,7 @@ Revision ID: 99
|
|||
Revises: 98
|
||||
Create Date: 2026-02-11
|
||||
|
||||
Adds report_status enum and reports table for storing generated Markdown reports.
|
||||
Adds reports table for storing generated Markdown reports.
|
||||
"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
|
|
@ -18,17 +18,6 @@ depends_on: str | Sequence[str] | None = None
|
|||
|
||||
|
||||
def upgrade() -> None:
|
||||
# Create the report_status enum type
|
||||
op.execute(
|
||||
"""
|
||||
DO $$ BEGIN
|
||||
CREATE TYPE report_status AS ENUM ('ready', 'failed');
|
||||
EXCEPTION
|
||||
WHEN duplicate_object THEN null;
|
||||
END $$;
|
||||
"""
|
||||
)
|
||||
|
||||
# Create the reports table
|
||||
op.execute(
|
||||
"""
|
||||
|
|
@ -37,7 +26,6 @@ def upgrade() -> None:
|
|||
title VARCHAR(500) NOT NULL,
|
||||
content TEXT,
|
||||
report_metadata JSONB,
|
||||
status report_status NOT NULL DEFAULT 'ready',
|
||||
report_style VARCHAR(100),
|
||||
search_space_id INTEGER NOT NULL
|
||||
REFERENCES searchspaces(id) ON DELETE CASCADE,
|
||||
|
|
@ -49,13 +37,6 @@ def upgrade() -> None:
|
|||
)
|
||||
|
||||
# Add indexes
|
||||
op.execute(
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS ix_reports_status
|
||||
ON reports(status);
|
||||
"""
|
||||
)
|
||||
|
||||
op.execute(
|
||||
"""
|
||||
CREATE INDEX IF NOT EXISTS ix_reports_search_space_id
|
||||
|
|
@ -82,7 +63,5 @@ def downgrade() -> None:
|
|||
op.execute("DROP INDEX IF EXISTS ix_reports_created_at")
|
||||
op.execute("DROP INDEX IF EXISTS ix_reports_thread_id")
|
||||
op.execute("DROP INDEX IF EXISTS ix_reports_search_space_id")
|
||||
op.execute("DROP INDEX IF EXISTS ix_reports_status")
|
||||
op.execute("DROP TABLE IF EXISTS reports")
|
||||
op.execute("DROP TYPE IF EXISTS report_status")
|
||||
|
||||
|
|
|
|||
|
|
@ -100,11 +100,6 @@ class PodcastStatus(str, Enum):
|
|||
FAILED = "failed"
|
||||
|
||||
|
||||
class ReportStatus(str, Enum):
|
||||
READY = "ready"
|
||||
FAILED = "failed"
|
||||
|
||||
|
||||
class DocumentStatus:
|
||||
"""
|
||||
Helper class for document processing status (stored as JSONB).
|
||||
|
|
@ -1044,18 +1039,6 @@ class Report(BaseModel, TimestampMixin):
|
|||
title = Column(String(500), nullable=False)
|
||||
content = Column(Text, nullable=True) # Markdown body
|
||||
report_metadata = Column(JSONB, nullable=True) # section headings, word count, etc.
|
||||
status = Column(
|
||||
SQLAlchemyEnum(
|
||||
ReportStatus,
|
||||
name="report_status",
|
||||
create_type=False,
|
||||
values_callable=lambda x: [e.value for e in x],
|
||||
),
|
||||
nullable=False,
|
||||
default=ReportStatus.READY,
|
||||
server_default="ready",
|
||||
index=True,
|
||||
)
|
||||
report_style = Column(String(100), nullable=True) # e.g. "executive_summary", "deep_research"
|
||||
|
||||
search_space_id = Column(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue