mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-04 13:22:41 +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")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue