Sha256: f658dbc6d3c093ec0252b5012b38627742af140a4ebd5bd2bd2a11877bf89d7e
Contents?: true
Size: 1.22 KB
Versions: 16
Compression:
Stored size: 1.22 KB
Contents
class CreateSpreeTaxonNameAndDescriptionTranslationsForMobilityTableBackend < ActiveRecord::Migration[6.1] def change # create translation table only if spree_globalize has not already created it if ActiveRecord::Base.connection.table_exists? 'spree_taxon_translations' # manually check for index since Rails if_exists does not always work correctly if ActiveRecord::Migration.connection.index_exists?(:spree_taxon_translations, :spree_taxon_id) # replacing this with index on spree_taxon_id and locale remove_index :spree_taxon_translations, name: "index_spree_taxon_translations_on_spree_taxon_id", if_exists: true end else create_table :spree_taxon_translations do |t| # Translated attribute(s) t.string :name t.text :description t.string :locale, null: false t.references :spree_taxon, null: false, foreign_key: true, index: false t.timestamps null: false end add_index :spree_taxon_translations, :locale, name: :index_spree_taxon_translations_on_locale end add_index :spree_taxon_translations, [:spree_taxon_id, :locale], name: :index_spree_taxon_translations_on_spree_taxon_id_and_locale, unique: true end end
Version data entries
16 entries across 16 versions & 1 rubygems