Sha256: c47c7b219ca42c092e341102a2505c2273b0c7e32356c96605de621b0fdb2841

Contents?: true

Size: 1.57 KB

Versions: 10

Compression:

Stored size: 1.57 KB

Contents

class CreateRapnsNotifications < ActiveRecord::VERSION::MAJOR >= 5 ? ActiveRecord::Migration[5.0] : ActiveRecord::Migration
  def self.up
    create_table :rapns_notifications do |t|
      t.integer   :badge,                 null: true
      t.string    :device_token,          null: false, limit: 64
      t.string    :sound,                 null: true,  default: "1.aiff"
      t.string    :alert,                 null: true
      t.text      :attributes_for_device, null: true
      t.integer   :expiry,                null: false, default: 1.day.to_i
      t.boolean   :delivered,             null: false, default: false
      t.timestamp :delivered_at,          null: true
      t.boolean   :failed,                null: false, default: false
      t.timestamp :failed_at,             null: true
      t.integer   :error_code,            null: true
      t.string    :error_description,     null: true
      t.timestamp :deliver_after,         null: true
      t.timestamps
    end

    add_index :rapns_notifications, [:delivered, :failed, :deliver_after], name: 'index_rapns_notifications_multi'
  end

  def self.down
    if ActiveRecord.version >= Gem::Version.new('5.1')
      if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi')
        remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
      end
    else
      if index_name_exists?(:rapns_notifications, 'index_rapns_notifications_multi', true)
        remove_index :rapns_notifications, name: 'index_rapns_notifications_multi'
      end
    end

    drop_table :rapns_notifications
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rpush-5.4.0 lib/generators/templates/create_rapns_notifications.rb
rpush-5.3.0 lib/generators/templates/create_rapns_notifications.rb
rpush-5.2.0 lib/generators/templates/create_rapns_notifications.rb
rpush-5.1.0 lib/generators/templates/create_rapns_notifications.rb
rpush-5.0.0 lib/generators/templates/create_rapns_notifications.rb
rpush-4.2.0 lib/generators/templates/create_rapns_notifications.rb
rpush-4.1.1 lib/generators/templates/create_rapns_notifications.rb
rpush-4.1.0 lib/generators/templates/create_rapns_notifications.rb
rpush-4.0.1 lib/generators/templates/create_rapns_notifications.rb
rpush-4.0.0 lib/generators/templates/create_rapns_notifications.rb