Sha256: 35ac9fd5d2af327ab84f1152a1414f375a2acf0648fdd338c0972f0da71c89e0
Contents?: true
Size: 828 Bytes
Versions: 4
Compression:
Stored size: 828 Bytes
Contents
# This migration comes from spree_auth (originally 20111206075712) class MigrateTokenizedPermissions < ActiveRecord::Migration def concat(str1, str2) dbtype = Rails.configuration.database_configuration[Rails.env]['adapter'].to_sym case dbtype when :mysql, :mysql2 "CONCAT(#{str1}, #{str2})" when :sqlserver "(#{str1} + #{str2})" else "(#{str1} || #{str2})" end end def up execute "UPDATE spree_tokenized_permissions SET permissable_type = #{concat("'Spree::'", "permissable_type")}" + " WHERE permissable_type NOT LIKE 'Spree::%' AND permissable_type IS NOT NULL" end def down execute "UPDATE spree_tokenized_permissions SET permissable_type = REPLACE(permissable_type, 'Spree::', '')" + " WHERE permissable_type LIKE 'Spree::%'" end end
Version data entries
4 entries across 4 versions & 1 rubygems