10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/osso/db/migrate/20210201220556_add_generic_saml_to_provider_service_enum.rb', line 10
def down
execute <<~SQL
CREATE TYPE identity_provider_service_new AS ENUM ('AZURE', 'OKTA', 'ONELOGIN', 'GOOGLE', 'PING', 'SALESFORCE');
-- Remove values that won't be compatible with new definition
DELETE FROM identity_providers WHERE service = 'OTHER';
-- Convert to new type, casting via text representation
ALTER TABLE identity_providers
ALTER COLUMN service TYPE identity_provider_service_new
USING (service::text::identity_provider_service_new);
-- and swap the types
DROP TYPE identity_provider_service;
ALTER TYPE identity_provider_service_new RENAME TO identity_provider_service;
SQL
end
|