diff --git a/scripts/sql/reset_db.sql b/scripts/sql/reset_db.sql index 8209713..f58112e 100644 --- a/scripts/sql/reset_db.sql +++ b/scripts/sql/reset_db.sql @@ -195,11 +195,24 @@ BEGIN GET DIAGNOSTICS rcount = ROW_COUNT; RAISE NOTICE 'Deleted % users', rcount; + DELETE + FROM expense_attributes_deletion_cache + WHERE workspace_id = _workspace_id; + GET DIAGNOSTICS rcount = ROW_COUNT; + RAISE NOTICE 'Deleted % expense_attributes_deletion_cache', rcount; + + + _org_id := (SELECT org_id FROM workspaces WHERE id = _workspace_id); + DELETE FROM workspaces w WHERE w.id = _workspace_id; GET DIAGNOSTICS rcount = ROW_COUNT; RAISE NOTICE 'Deleted % workspaces', rcount; + + RAISE NOTICE E'\n\n\n\n\n\n\n\n\nSwitch to prod db and run the below queries to delete dependent fields'; + RAISE NOTICE E'rollback;begin; delete from platform_schema.dependent_expense_field_mappings where expense_field_id in (select id from platform_schema.expense_fields where org_id =''%'' and type=''DEPENDENT_SELECT''); delete from platform_schema.expense_fields where org_id = ''%'' and type = ''DEPENDENT_SELECT'';\n\n\n\n\n\n\n\n\n\n\n', _org_id, _org_id; + RETURN; END $$ LANGUAGE plpgsql;