feat(mindspace): 公开页分享组件、workspace 路径与 Plaza 发布增强
- 新增 public share widget 与 workspace relative path 解析 - 增强 publications/chat-plaza 发布链路与缩略图 demo - 补充 schema、cover 检查脚本与回归测试 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -771,6 +771,53 @@ export async function migrateSchema(pool) {
|
||||
)
|
||||
`);
|
||||
|
||||
if (!(await columnExists(pool, 'h5_page_records', 'workspace_relative_path'))) {
|
||||
await pool.query(
|
||||
`ALTER TABLE h5_page_records
|
||||
ADD COLUMN workspace_relative_path VARCHAR(512) NULL AFTER draft_content_ref`,
|
||||
);
|
||||
}
|
||||
if (!(await indexExists(pool, 'h5_page_records', 'idx_h5_pages_workspace_path'))) {
|
||||
await pool.query(
|
||||
`ALTER TABLE h5_page_records
|
||||
ADD KEY idx_h5_pages_workspace_path (user_id, workspace_relative_path, updated_at)`,
|
||||
);
|
||||
}
|
||||
if (!(await columnExists(pool, 'h5_assets', 'workspace_relative_path'))) {
|
||||
await pool.query(
|
||||
`ALTER TABLE h5_assets
|
||||
ADD COLUMN workspace_relative_path VARCHAR(512) NULL AFTER display_name`,
|
||||
);
|
||||
}
|
||||
if (!(await indexExists(pool, 'h5_assets', 'idx_h5_assets_workspace_path'))) {
|
||||
await pool.query(
|
||||
`ALTER TABLE h5_assets
|
||||
ADD KEY idx_h5_assets_workspace_path (user_id, workspace_relative_path, updated_at)`,
|
||||
);
|
||||
}
|
||||
await pool.query(
|
||||
`UPDATE h5_page_records p
|
||||
JOIN h5_page_versions pv ON pv.id = p.current_version_id
|
||||
SET p.workspace_relative_path = JSON_UNQUOTE(JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path'))
|
||||
WHERE p.workspace_relative_path IS NULL
|
||||
AND JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path') IS NOT NULL
|
||||
AND JSON_UNQUOTE(JSON_EXTRACT(pv.source_snapshot_json, '$.relative_path')) <> ''`,
|
||||
);
|
||||
await pool.query(
|
||||
`UPDATE h5_assets a
|
||||
JOIN h5_space_categories c ON c.id = a.category_id AND c.user_id = a.user_id
|
||||
SET a.workspace_relative_path = CASE
|
||||
WHEN a.original_filename LIKE 'public/%' OR a.original_filename LIKE 'oa/%'
|
||||
THEN a.original_filename
|
||||
WHEN c.category_code IN ('public', 'oa')
|
||||
THEN CONCAT(c.category_code, '/', a.original_filename)
|
||||
ELSE NULL
|
||||
END
|
||||
WHERE a.workspace_relative_path IS NULL
|
||||
AND a.status <> 'deleted'
|
||||
AND c.category_code IN ('public', 'oa')`,
|
||||
);
|
||||
|
||||
await pool.query(`
|
||||
CREATE TABLE IF NOT EXISTS h5_user_feedback (
|
||||
id CHAR(36) PRIMARY KEY,
|
||||
|
||||
Reference in New Issue
Block a user