Skip services.group_title copy when the legacy column is absent.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alexey Novikov
2026-09-16 13:38:13 +03:00
co-authored by Cursor
parent 5b58013ec8
commit f94d08a101
+11 -1
View File
@@ -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 $$
`,
)
}