25 lines
833 B
PL/PgSQL
25 lines
833 B
PL/PgSQL
BEGIN;
|
|||
|
|
|
||
|
|
DROP TABLE IF EXISTS consent_record;
|
||
|
|
DROP TABLE IF EXISTS subject_fact;
|
||
|
|
|
||
|
|
ALTER TABLE subject_profile
|
||
|
|
DROP CONSTRAINT IF EXISTS subject_profile_created_by_tenant_fk,
|
||
|
|
DROP CONSTRAINT IF EXISTS subject_profile_updated_by_tenant_fk,
|
||
|
|
DROP CONSTRAINT IF EXISTS subject_profile_status_check;
|
||
|
|
|
||
|
|
UPDATE subject_profile SET status='inactive' WHERE status='suspended';
|
||
|
|
UPDATE subject_profile SET status='deleted' WHERE status='deleting';
|
||
|
|
|
||
|
|
ALTER TABLE subject_profile
|
||
|
|
DROP COLUMN IF EXISTS language,
|
||
|
|
DROP COLUMN IF EXISTS timezone,
|
||
|
|
DROP COLUMN IF EXISTS profile_data,
|
||
|
|
DROP COLUMN IF EXISTS conversation_preferences,
|
||
|
|
DROP COLUMN IF EXISTS created_by,
|
||
|
|
DROP COLUMN IF EXISTS updated_by,
|
||
|
|
ADD CONSTRAINT subject_profile_status_check
|
||
|
|
CHECK (status IN ('active', 'inactive', 'deleted'));
|
||
|
|
|
||
|
|
COMMIT;
|