Class: Adyen::Notification::Migration

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

Class Method Summary collapse

Class Method Details

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



93
94
95
96
# File 'lib/adyen/notification.rb', line 93

def self.down(table_name = Adyen::Notification::DEFAULT_TABLE_NAME)
  remove_index(table_name, [:psp_reference, :event_code, :success])
  drop_table(table_name)
end

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



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/adyen/notification.rb', line 72

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
end