10 lines
592 B
PL/PgSQL
10 lines
592 B
PL/PgSQL
BEGIN;
|
|
DROP TRIGGER prevent_archived_course_publication ON exam_prep.catalog_courses;
|
|
DROP FUNCTION prevent_archived_course_publication();
|
|
-- Restore only records still in the exact state written by this migration.
|
|
UPDATE exam_prep.catalog_courses c SET publish_status=a.previous_publish_status,updated_at=a.previous_updated_at
|
|
FROM academy_archived_courses a WHERE a.course_id=c.id AND c.publish_status='DRAFT' AND c.updated_at=a.archived_at;
|
|
DROP TABLE academy_archived_courses;
|
|
-- Keep starter drafts and provenance: deleting them could erase subsequent authored work or progress.
|
|
COMMIT;
|