Files
edgeever/migrations/0079_workspace_example_seeds.sql
edgeever-updater[bot] 83a99699c3 chore: update EdgeEver from v2.9.0
EdgeEver-Upstream-Commit: d5c62eeda4ece2affc36c7d5463c87dd7a8a292f
2026-10-27 07:52:48 +00:00

35 lines
1.3 KiB
SQL

-- Example notebooks wait here until the API can write their generated notes.
-- A row means the workspace still waits. The API removes it after seeding, or
-- when the workspace is no longer eligible, so a failed attempt is retried.
CREATE TABLE IF NOT EXISTS workspace_example_seeds (
workspace_id TEXT PRIMARY KEY REFERENCES workspaces(id) ON DELETE CASCADE,
created_at TEXT NOT NULL DEFAULT (strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))
);
-- Only an upgrade whose sole surviving note is the untouched system welcome
-- note qualifies. A second note, a deleted note, or a user edit leaves the
-- workspace unchanged. New workspaces insert their own pending row at creation.
INSERT OR IGNORE INTO workspace_example_seeds (workspace_id)
SELECT w.id
FROM workspaces w
WHERE EXISTS (
SELECT 1 FROM memos m
WHERE m.workspace_id = w.id
AND m.is_deleted = 0
AND m.id = 'memo_welcome'
AND m.created_by = 'system'
AND m.updated_by = 'system'
AND m.title IN (
'欢迎来到 EdgeEver',
'Welcome to EdgeEver',
'EdgeEver へようこそ',
'Witaj w EdgeEver',
'Добро пожаловать в EdgeEver'
)
)
AND NOT EXISTS (
SELECT 1 FROM memos m
WHERE m.workspace_id = w.id
AND NOT (m.is_deleted = 0 AND m.id = 'memo_welcome')
);