Files
probably-rendering-one-more…/apps/waterfall-wiki/db/003_note_descriptions.sql
codex-bot ad398db781
waterfall-wiki CI and deployment / verify-and-deploy (push) Has been cancelled
studio CI and deployment / verify-and-deploy (push) Successful in 9m15s
Restore PROMPT branding, rename waterfall-wiki, and add system tag workflows
2026-10-27 00:35:59 +08:00

10 lines
441 B
PL/PgSQL

BEGIN;
ALTER TABLE posts ADD COLUMN IF NOT EXISTS description text NOT NULL DEFAULT '';
UPDATE posts p SET description=left(COALESCE((
SELECT a.body FROM post_assets pa JOIN assets a ON a.id=pa.asset_id
WHERE pa.post_id=p.id AND a.kind='text' AND a.body IS NOT NULL
ORDER BY pa.position LIMIT 1
),p.title),200) WHERE p.description='';
INSERT INTO schema_migrations(version) VALUES('003_note_descriptions') ON CONFLICT DO NOTHING;
COMMIT;