Sha256: 22bc4ed9b620c17e343ed4082fee04ff818caac7e2ffa309a60e53177cd7b937
Contents?: true
Size: 994 Bytes
Versions: 5
Compression:
Stored size: 994 Bytes
Contents
class CreatePropertyTranslations < ActiveRecord::Migration[6.1] def change if ActiveRecord::Base.connection.table_exists?('spree_property_translations') # manually check for index since Rails if_exists does not always work correctly if ActiveRecord::Migration.connection.index_exists?(:spree_property_translations, :spree_property_id) remove_index :spree_property_translations, column: :spree_property_id, if_exists: true end else create_table :spree_property_translations do |t| # Translated attribute(s) t.string :presentation t.string :locale, null: false t.references :spree_property, null: false, foreign_key: true, index: false t.timestamps end add_index :spree_property_translations, :locale, name: :index_spree_property_translations_on_locale end add_index :spree_property_translations, [:spree_property_id, :locale], name: :unique_property_id_per_locale, unique: true end end
Version data entries
5 entries across 5 versions & 1 rubygems