CREATE TABLE config_revision_preview ( revision_id TEXT NOT NULL PRIMARY KEY REFERENCES config_revision (id) ON DELETE CASCADE, fragments TEXT NOT NULL DEFAULT '{}' ); INSERT INTO config_revision_preview (revision_id, fragments) SELECT id, json(COALESCE(json_extract(meta_json, '$.preview_fragments'), '{}')) FROM config_revision WHERE json_extract(meta_json, '$.preview_fragments') IS NOT NULL; UPDATE config_revision SET meta_json = json_remove(meta_json, '$.preview_fragments') WHERE json_extract(meta_json, '$.preview_fragments') IS NOT NULL;