Skip services.group_title copy when the legacy column is absent.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -15,13 +15,23 @@ export async function ensureServicesSchema(payload: Payload) {
|
||||
await exec(
|
||||
payload,
|
||||
sql`
|
||||
DO $$ BEGIN
|
||||
IF EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'services'
|
||||
AND column_name = 'group_title'
|
||||
) THEN
|
||||
UPDATE services_locales AS sl
|
||||
SET group_title = s.group_title
|
||||
FROM services AS s
|
||||
WHERE sl._parent_id = s.id
|
||||
AND sl._locale = 'ru'
|
||||
AND (sl.group_title IS NULL OR sl.group_title = '')
|
||||
AND s.group_title IS NOT NULL
|
||||
AND s.group_title IS NOT NULL;
|
||||
END IF;
|
||||
END $$
|
||||
`,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user