Class: Adyen::Notification::Migration

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/adyen/notification.rb

Overview

An ActiveRecord migration that can be used to create a suitable table

to store Adyen::Notification instances for your application.

Class Method Summary collapse

Class Method Details

.down(table_name = Adyen::Notification::DEFAULT_TABLE_NAME) ⇒ Object



145
146
147
148
# File 'lib/adyen/notification.rb', line 145

def self.down(table_name = Adyen::Notification::DEFAULT_TABLE_NAME)
  remove_index(table_name, :name => 'adyen_notification_uniqueness')
  drop_table(table_name)
end

.up(table_name = Adyen::Notification::DEFAULT_TABLE_NAME) ⇒ Object



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'lib/adyen/notification.rb', line 124

def self.up(table_name = Adyen::Notification::DEFAULT_TABLE_NAME)
  create_table(table_name) do |t|
    t.boolean  :live,                  :null => false, :default => false
    t.string   :event_code,            :null => false
    t.string   :psp_reference,         :null => false
    t.string   :original_reference,    :null => true
    t.string   :merchant_reference,    :null => false
    t.string   :merchant_account_code, :null => false
    t.datetime :event_date,            :null => false
    t.boolean  :success,               :null => false, :default => false
    t.string   :payment_method,        :null => true
    t.string   :operations,            :null => true
    t.text     :reason
    t.string   :currency,              :null => false, :limit => 3
    t.decimal  :value,                 :null => true, :precision => 9, :scale => 2
    t.boolean  :processed,             :null => false, :default => false
    t.timestamps
  end
  add_index table_name, [:psp_reference, :event_code, :success], :unique => true, :name => 'adyen_notification_uniqueness'
end