10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/osso/db/migrate/20201125143501_add_salesforce_to_provider_service_enum.rb', line 10
def down
execute <<~SQL
CREATE TYPE identity_provider_service_new AS ENUM ('AZURE', 'OKTA', 'ONELOGIN', 'GOOGLE', 'PING');
-- Remove values that won't be compatible with new definition
DELETE FROM identity_providers WHERE service = 'SALESFORCE';
-- 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
|