Class: CreateDoubleEntryTables

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

Class Method Summary collapse

Class Method Details

.downObject



60
61
62
63
64
65
# File 'lib/generators/double_entry/install/templates/migration.rb', line 60

def self.down
  drop_table "double_entry_line_checks"
  drop_table "double_entry_line_aggregates"
  drop_table "double_entry_lines"
  drop_table "double_entry_account_balances"
end

.upObject



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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/generators/double_entry/install/templates/migration.rb', line 3

def self.up
  create_table "double_entry_account_balances", :force => true do |t|
    t.string   "account",    :null => false
    t.string   "scope"
    t.integer  "balance"
    t.timestamps
  end

  add_index "double_entry_account_balances", ["account"], :name => "index_account_balances_on_account"
  add_index "double_entry_account_balances", ["scope", "account"], :name => "index_account_balances_on_scope_and_account", :unique => true

  create_table "double_entry_lines", :force => true do |t|
    t.string   "account"
    t.string   "scope"
    t.string   "code"
    t.integer  "amount"
    t.integer  "balance"
    t.integer  "partner_id"
    t.string   "partner_account"
    t.string   "partner_scope"
    t.integer  "detail_id"
    t.string   "detail_type"
    t.timestamps
  end

  add_index "double_entry_lines", ["account", "code", "created_at"], :name => "lines_account_code_created_at_idx"
  add_index "double_entry_lines", ["account", "created_at"], :name => "lines_account_created_at_idx"
  add_index "double_entry_lines", ["scope", "account", "created_at"], :name => "lines_scope_account_created_at_idx"
  add_index "double_entry_lines", ["scope", "account", "id"], :name => "lines_scope_account_id_idx"

  create_table "double_entry_line_aggregates", :force => true do |t|
    t.string   "function"
    t.string   "account"
    t.string   "code"
    t.string   "scope"
    t.integer  "year"
    t.integer  "month"
    t.integer  "week"
    t.integer  "day"
    t.integer  "hour"
    t.integer  "amount"
    t.timestamps
    t.string   "filter"
    t.string   "range_type"
  end

  add_index "double_entry_line_aggregates", ["function", "account", "code", "year", "month", "week", "day"], :name => "line_aggregate_idx"

  create_table "double_entry_line_checks", :force => true do |t|
    t.integer  "last_line_id"
    t.boolean  "errors_found"
    t.text     "log"
    t.timestamps
  end

end