refactor teaching domain naming to course/course_section/course_group
Add diesel migrations and synchronize backend/frontend model fields plus jsonb key migration to support generic teaching subjects beyond piano-specific naming. Made-with: Cursor
This commit is contained in:
+1
@@ -0,0 +1 @@
|
||||
ALTER TABLE kecheng RENAME COLUMN course_sections TO qumu_sections;
|
||||
+1
@@ -0,0 +1 @@
|
||||
ALTER TABLE kecheng RENAME COLUMN qumu_sections TO course_sections;
|
||||
@@ -0,0 +1,22 @@
|
||||
UPDATE kecheng
|
||||
SET course_sections = jsonb_set(
|
||||
course_sections,
|
||||
'{vals}',
|
||||
COALESCE((
|
||||
SELECT jsonb_agg(
|
||||
(item - 'course_id' - 'course_type' - 'course_name' - 'course_text' - 'course_category_key' - 'course_category_name') ||
|
||||
jsonb_build_object(
|
||||
'qumu_id', item->'course_id',
|
||||
'qumu_type', item->'course_type',
|
||||
'qumu_name', item->'course_name',
|
||||
'qumu_text', item->'course_text',
|
||||
'qumu_category_key', item->'course_category_key',
|
||||
'qumu_category_name', item->'course_category_name'
|
||||
)
|
||||
)
|
||||
FROM jsonb_array_elements(course_sections->'vals') AS item
|
||||
), '[]'::jsonb),
|
||||
true
|
||||
)
|
||||
WHERE course_sections IS NOT NULL
|
||||
AND course_sections ? 'vals';
|
||||
@@ -0,0 +1,22 @@
|
||||
UPDATE kecheng
|
||||
SET course_sections = jsonb_set(
|
||||
course_sections,
|
||||
'{vals}',
|
||||
COALESCE((
|
||||
SELECT jsonb_agg(
|
||||
(item - 'qumu_id' - 'qumu_type' - 'qumu_name' - 'qumu_text' - 'qumu_category_key' - 'qumu_category_name') ||
|
||||
jsonb_build_object(
|
||||
'course_id', item->'qumu_id',
|
||||
'course_type', item->'qumu_type',
|
||||
'course_name', item->'qumu_name',
|
||||
'course_text', item->'qumu_text',
|
||||
'course_category_key', item->'qumu_category_key',
|
||||
'course_category_name', item->'qumu_category_name'
|
||||
)
|
||||
)
|
||||
FROM jsonb_array_elements(course_sections->'vals') AS item
|
||||
), '[]'::jsonb),
|
||||
true
|
||||
)
|
||||
WHERE course_sections IS NOT NULL
|
||||
AND course_sections ? 'vals';
|
||||
Reference in New Issue
Block a user