Sha256: 1d2758bcf274c92cf98a79b739ee8e275af869f58a40e005c50836af91e4c0a1

Contents?: true

Size: 878 Bytes

Versions: 22

Compression:

Stored size: 878 Bytes

Contents

class AddOneLoginToIdentityProviderServiceEnum < ActiveRecord::Migration[6.0]
  disable_ddl_transaction!

  def up
    execute <<-SQL
      ALTER TYPE identity_provider_service ADD VALUE 'ONELOGIN';
    SQL
  end
  
  def down
    execute <<~SQL
      CREATE TYPE identity_provider_service_new AS ENUM ('AZURE', 'OKTA');

      -- Remove values that won't be compatible with new definition
      DELETE FROM identity_providers WHERE service = 'ONELOGIN';
      
      -- 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
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
osso-0.1.2 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.1.1 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.1.0 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.11 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.10 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.8 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.7 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.6 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.6.alpha lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5 lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.lambda lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.kappa lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.iota lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.theta lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.eta lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.zeta lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.epsilon lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.delta lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.gamma lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb
osso-0.0.5.pre.beta lib/osso/db/migrate/20200913154919_add_one_login_to_identity_provider_service_enum.rb