Class: CreateHarmonizeTables

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/rails/generators/harmonize/templates/migration.rb

Class Method Summary collapse

Class Method Details

.downObject



29
30
31
32
# File 'lib/rails/generators/harmonize/templates/migration.rb', line 29

def self.down
  drop_table :harmonize_logs
  drop_table :harmonize_modifications
end

.upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rails/generators/harmonize/templates/migration.rb', line 2

def self.up
  create_table :harmonize_logs do |t|
    t.string    :key
    t.string    :class_name
    t.string    :harmonizer_name
    t.string    :strategy
    t.string    :strategy_arguments
    t.datetime  :start
    t.datetime  :end
    t.timestamps
  end
  add_index :harmonize_logs, [ :class_name, :harmonizer_name ]

  create_table :harmonize_modifications do |t|
    t.integer  :harmonize_log_id
    t.integer  :instance_id
    t.string   :modification_type
    t.datetime :before_time
    t.datetime :after_time
    t.text     :instance_errors
    t.timestamps
  end
  add_index :harmonize_modifications, :harmonize_log_id
  add_index :harmonize_modifications, [ :harmonize_log_id, :instance_id ], :name => 'index_harmonize_modification_with_id'
  add_index :harmonize_modifications, [ :harmonize_log_id, :instance_id, :modification_type ], :name => 'index_harmonize_modification_with_id_and_type'
end