- Migration 0009: note_links (source_id, target_norm). Parse [[...]] from body on
create/update and rewrite the source's links. GET /api/notes/titles (owner
{id,title} index for client-side resolution); GET /api/notes/<id>/backlinks.
- Frontend: titles store; LinkedText renders [[Title]] styled on cards; editor
shows Links (outgoing, resolve/create-on-click) + Linked-from (backlinks),
clicking navigates the editor to the target note (board + search).
- notes store: fetchOne, createTitled. DB-free link-parser tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
32 lines
918 B
Python
32 lines
918 B
Python
"""note_links (wiki-links)
|
|
|
|
Revision ID: 0009
|
|
Revises: 0008
|
|
Create Date: 2026-07-20
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
|
|
revision = "0009"
|
|
down_revision = "0008"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"note_links",
|
|
sa.Column("id", UUID(as_uuid=True), primary_key=True),
|
|
sa.Column("source_id", UUID(as_uuid=True), sa.ForeignKey("notes.id", ondelete="CASCADE"), nullable=False),
|
|
sa.Column("target_norm", sa.Text(), nullable=False),
|
|
)
|
|
op.create_index("ix_note_links_source", "note_links", ["source_id"])
|
|
op.create_index("ix_note_links_target", "note_links", ["target_norm"])
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_index("ix_note_links_target", table_name="note_links")
|
|
op.drop_index("ix_note_links_source", table_name="note_links")
|
|
op.drop_table("note_links")
|