22a3a3c1d1
Vue 3 + TypeScript frontend with Pinia stores, markdown rendering (marked + DOMPurify), wikilink/tag linkification, and autocomplete. Quart async backend with SQLAlchemy 2.0, PostgreSQL ARRAY columns, task-note companion linking, backlinks, and note-to-task conversion. Docker Compose setup with PostgreSQL 16 and Ollama. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
77 lines
2.3 KiB
Python
77 lines
2.3 KiB
Python
"""create tasks table
|
|
|
|
Revision ID: 0002
|
|
Revises:
|
|
Create Date: 2025-01-01 00:00:00.000000
|
|
"""
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import ARRAY
|
|
|
|
revision = "0002"
|
|
down_revision = None
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
task_status = sa.Enum("todo", "in_progress", "done", name="task_status")
|
|
task_status.create(op.get_bind(), checkfirst=True)
|
|
|
|
task_priority = sa.Enum("none", "low", "medium", "high", name="task_priority")
|
|
task_priority.create(op.get_bind(), checkfirst=True)
|
|
|
|
op.create_table(
|
|
"tasks",
|
|
sa.Column("id", sa.Integer(), primary_key=True),
|
|
sa.Column("title", sa.Text(), nullable=False, server_default=""),
|
|
sa.Column("description", sa.Text(), nullable=False, server_default=""),
|
|
sa.Column(
|
|
"status",
|
|
task_status,
|
|
nullable=False,
|
|
server_default="todo",
|
|
),
|
|
sa.Column(
|
|
"priority",
|
|
task_priority,
|
|
nullable=False,
|
|
server_default="none",
|
|
),
|
|
sa.Column("due_date", sa.Date(), nullable=True),
|
|
sa.Column(
|
|
"note_id",
|
|
sa.Integer(),
|
|
sa.ForeignKey("notes.id", ondelete="SET NULL"),
|
|
nullable=True,
|
|
),
|
|
sa.Column("tags", ARRAY(sa.Text()), nullable=False, server_default="{}"),
|
|
sa.Column(
|
|
"created_at",
|
|
sa.DateTime(timezone=True),
|
|
nullable=False,
|
|
server_default=sa.func.now(),
|
|
),
|
|
sa.Column(
|
|
"updated_at",
|
|
sa.DateTime(timezone=True),
|
|
nullable=False,
|
|
server_default=sa.func.now(),
|
|
),
|
|
)
|
|
|
|
op.create_index("ix_tasks_tags", "tasks", ["tags"], postgresql_using="gin")
|
|
op.create_index("ix_tasks_note_id", "tasks", ["note_id"])
|
|
op.create_index("ix_tasks_status", "tasks", ["status"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_tasks_status", table_name="tasks")
|
|
op.drop_index("ix_tasks_note_id", table_name="tasks")
|
|
op.drop_index("ix_tasks_tags", table_name="tasks")
|
|
op.drop_table("tasks")
|
|
|
|
sa.Enum(name="task_priority").drop(op.get_bind(), checkfirst=True)
|
|
sa.Enum(name="task_status").drop(op.get_bind(), checkfirst=True)
|