Sha256: acfebad38da0479c8b754306815c9981c82b98d11d04b29dc07fe0395acec134
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
class Rpush200Updates < ActiveRecord::Migration def self.up add_column :rpush_notifications, :processing, :boolean, null: false, default: false add_column :rpush_notifications, :priority, :integer, null: true if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi, true) remove_index :rpush_notifications, name: :index_rpush_notifications_multi end add_index :rpush_notifications, [:delivered, :failed], name: 'index_rpush_notifications_multi', where: 'NOT delivered AND NOT failed' rename_column :rpush_feedback, :app, :app_id if postgresql? execute('ALTER TABLE rpush_feedback ALTER COLUMN app_id TYPE integer USING (trim(app_id)::integer)') else change_column :rpush_feedback, :app_id, :integer end end def self.down change_column :rpush_feedback, :app_id, :string rename_column :rpush_feedback, :app_id, :app if index_name_exists?(:rpush_notifications, :index_rpush_notifications_multi, true) remove_index :rpush_notifications, name: :index_rpush_notifications_multi end add_index :rpush_notifications, [:app_id, :delivered, :failed, :deliver_after], name: 'index_rpush_notifications_multi' remove_column :rpush_notifications, :priority remove_column :rpush_notifications, :processing end def self.adapter_name ActiveRecord::Base.configurations[Rails.env]['adapter'] end def self.postgresql? adapter_name =~ /postgresql/ end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rpush-2.0.0-java | lib/generators/templates/rpush_2_0_0_updates.rb |
rpush-2.0.0 | lib/generators/templates/rpush_2_0_0_updates.rb |