Sha256: 70a0f5e8485b724c918ae309e333ac77b341abc2c600088363ffab7eaa8a2ec4

Contents?: true

Size: 381 Bytes

Versions: 21

Compression:

Stored size: 381 Bytes

Contents

class EnsureDefaultStore < ActiveRecord::Migration[4.2]
  class Store < ActiveRecord::Base
    self.table_name = 'spree_stores'
  end

  def up
    unless Store.where(default: true).exists?
      store = Store.first
      raise "Database has no stores. One should have been created in a previous migration." unless store
      store.update_column(:default, true)
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
solidus_core-2.3.1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.2.2 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.1.1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.0.3 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.3.0 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.3.0.rc3 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.3.0.rc2 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.3.0.rc1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.3.0.beta1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.0.2 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.2.1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.2.0 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.2.0.rc1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.2.0.beta1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.1.0 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.1.0.rc1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.0.1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.1.0.beta1 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.0.0 db/migrate/20160608162651_ensure_default_store.rb
solidus_core-2.0.0.rc1 db/migrate/20160608162651_ensure_default_store.rb