Sha256: f958906fac7e0ca5ba5ac1ad085eb210a1e45535a79596c6ef54b96dbda54e9d

Contents?: true

Size: 962 Bytes

Versions: 1

Compression:

Stored size: 962 Bytes

Contents

class AddMobilityTranslationsToVendor < ActiveRecord::Migration[6.1]
  def change
    if ActiveRecord::Base.connection.table_exists?('spree_vendor_translations')
      if ActiveRecord::Migration.connection.index_exists?(:spree_vendors_translations, :spree_vendor_id)
        remove_index :spree_vendor_translations, column: :spree_vendor_id, if_exists: true
      end
    else
      create_table :spree_vendor_translations do |t|
        # Translated attribute(s)
        t.string :name
        t.text :about_us
        t.text :contact_us
        t.string :slug

        t.string  :locale, null: false
        t.references :spree_vendor, null: false, foreign_key: true, index: false

        t.timestamps null: false
      end

      add_index :spree_vendor_translations, :locale, name: :index_spree_vendor_translations_on_locale
      add_index :spree_vendor_translations, [:locale, :slug], unique: true, name: 'vendor_unique_slug_per_locale'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_multi_vendor-2.5.0 db/migrate/20231114090744_add_mobility_translations_to_vendor.rb