internal/store/migrations/0058_profile_about_out.down.sql

v1.37.0
gitbay/internal/store/migrations/0058_profile_about_out.down.sql history · blame · raw

20 lines · 990 bytes

 1ALTER TABLE users ADD COLUMN about TEXT NOT NULL DEFAULT '';
 2ALTER TABLE users ADD COLUMN about_format TEXT NOT NULL DEFAULT 'md';
 3ALTER TABLE orgs ADD COLUMN about TEXT NOT NULL DEFAULT '';
 4ALTER TABLE orgs ADD COLUMN about_format TEXT NOT NULL DEFAULT 'md';
 5
 6UPDATE users SET
 7  about = (SELECT about FROM profile_about_backfill
 8            WHERE owner_kind = 'user' AND owner_id = users.id),
 9  about_format = (SELECT about_format FROM profile_about_backfill
10            WHERE owner_kind = 'user' AND owner_id = users.id)
11  WHERE id IN (SELECT owner_id FROM profile_about_backfill WHERE owner_kind = 'user');
12
13UPDATE orgs SET
14  about = (SELECT about FROM profile_about_backfill
15            WHERE owner_kind = 'org' AND owner_id = orgs.id),
16  about_format = (SELECT about_format FROM profile_about_backfill
17            WHERE owner_kind = 'org' AND owner_id = orgs.id)
18  WHERE id IN (SELECT owner_id FROM profile_about_backfill WHERE owner_kind = 'org');
19
20DROP TABLE profile_about_backfill;