Sha256: 39f547478b878fd5cfb2eed91b236ac67732fe4356a8ebcbaecd0f17b7098bed

Contents?: true

Size: 1.02 KB

Versions: 11

Compression:

Stored size: 1.02 KB

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 :name
        t.string :presentation
        t.string :filter_param

        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

11 entries across 11 versions & 1 rubygems

Version Path
spree_core-4.7.3 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.6 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.5 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.7.2 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.7.1 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.4 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.7.0 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.3 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.2 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.1 db/migrate/20230109105943_create_property_translations.rb
spree_core-4.6.0 db/migrate/20230109105943_create_property_translations.rb