Sha256: e6e1db09c82d850c160805dac1e7e2ddecf73206595f0c181e60d6f0e99b2f69

Contents?: true

Size: 1.59 KB

Versions: 7

Compression:

Stored size: 1.59 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::MAJOR >= 5 && ActiveRecord::VERSION::MINOR >= 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

7 entries across 7 versions & 2 rubygems

Version Path
rpush-3.3.1 lib/generators/templates/create_rapns_notifications.rb
rpush-3.3.0 lib/generators/templates/create_rapns_notifications.rb
rpush_extended-3.2.6 lib/generators/templates/create_rapns_notifications.rb
rpush_extended-3.2.5 lib/generators/templates/create_rapns_notifications.rb
rpush-3.2.4 lib/generators/templates/create_rapns_notifications.rb
rpush-3.2.3 lib/generators/templates/create_rapns_notifications.rb
rpush-3.2.2 lib/generators/templates/create_rapns_notifications.rb