Files
blackbird/db2/scripts/patch_003_users_admin_notes_visibility.sql
T
qing 0ed03ac095 feat(db2): Users 管理员标记 + Notes 可见性/可编辑性(patch_003)
- create_sqlite3.sql 全量建库脚本同步 is_admin / is_public / everyone_editable 三列
- 新增 patch_003_users_admin_notes_visibility.sql 存量库增量迁移
- 默认值保持向后兼容:非管理员、节点公开、人人可编辑
2026-08-22 11:10:11 +00:00

18 lines
1.2 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 补丁 003:Users 管理员标记 + Notes 可见性/可编辑性
-- 数据库类型: SQLite
-- 依赖: create_sqlite3.sql(或等价 schema)已执行,且 patch_001 / patch_002 已按序执行
-- 幂等性: ADD COLUMN 为一次性迁移,重复执行会报 "duplicate column name",
-- 请按迁移编号顺序执行一次。
--
-- 语义(默认值向后兼容现有行为):
-- Users.is_admin 是否管理员,默认 0(普通用户)
-- Notes.is_public 节点是否公开可读,默认 1(公开,与现状一致)
-- Notes.everyone_editable 是否任何人都能编辑,默认 1(人人可编辑)
-- ── Users 新增管理员标记 ─────────────────────────────────────────────
ALTER TABLE Users ADD COLUMN is_admin BOOLEAN NOT NULL DEFAULT 0;
-- ── Notes 新增可见性 / 可编辑性 ──────────────────────────────────────
ALTER TABLE Notes ADD COLUMN is_public BOOLEAN NOT NULL DEFAULT 1;
ALTER TABLE Notes ADD COLUMN everyone_editable BOOLEAN NOT NULL DEFAULT 1;