feat: sous-pages — parent_id, sidebar hiérarchique, bouton +New sub-page
- DB: parent_id dans table pages (ALTER TABLE migration auto) - Sidebar: pages parent_id IS NULL affichées, sous-pages indentées en dessous - API: create_page accepte parent_id (0 = racine) - JS: newSubPage extrait page ID et passe parent_id - page_editor: liste les sous-pages + bouton '+ New sub-page'
This commit is contained in:
@@ -137,10 +137,16 @@ def init_db():
|
||||
title TEXT NOT NULL DEFAULT 'New page',
|
||||
content TEXT NOT NULL DEFAULT '',
|
||||
parent_section TEXT DEFAULT 'Private',
|
||||
parent_id INTEGER REFERENCES pages(id),
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
""")
|
||||
# Migration: add parent_id if missing (v1.0.0+)
|
||||
try:
|
||||
conn.execute("ALTER TABLE pages ADD COLUMN parent_id INTEGER REFERENCES pages(id)")
|
||||
except sqlite3.OperationalError:
|
||||
pass
|
||||
conn.commit()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user