Sha256: ff16150fbfc5a24684d5ba230711ff01302dc7f8569e55a75846f8bb66088091

Contents?: true

Size: 914 Bytes

Versions: 6

Compression:

Stored size: 914 Bytes

Contents

class CreateSpreeTrackers < SpreeExtension::Migration[4.2]
  def change
    if table_exists?(:spree_trackers)
      add_index :spree_trackers, :active unless index_exists?(:spree_trackers, :active)
      remove_column :spree_trackers, :environment if column_exists?(:spree_trackers, :environment)
      unless column_exists?(:spree_trackers, :engine)
        add_column :spree_trackers, :kind, :integer, default: 0, null: false, index: true unless column_exists?(:spree_trackers, :kind)
        rename_column :spree_trackers, :kind, :engine if column_exists?(:spree_trackers, :kind)
      end
    else
      create_table :spree_trackers do |t|
        t.string 'analytics_id'
        t.boolean 'active', default: true, index: true
        t.datetime 'created_at', null: false
        t.datetime 'updated_at', null: false
        t.integer 'engine', default: 0, null: false, index: true
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
spree_analytics_trackers-2.1.1 db/migrate/20171013160337_create_spree_trackers.rb
spree_analytics_trackers-2.1.0 db/migrate/20171013160337_create_spree_trackers.rb
spree_analytics_trackers-2.0.0 db/migrate/20171013160337_create_spree_trackers.rb
spree_analytics_trackers-2.0.0.rc1 db/migrate/20171013160337_create_spree_trackers.rb
spree_analytics_trackers-1.1.0 db/migrate/20171013160337_create_spree_trackers.rb
spree_analytics_trackers-1.0.1 db/migrate/20171013160337_create_spree_trackers.rb