Class: CreatePacioliTables

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

Class Method Summary collapse

Class Method Details

.changeObject



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
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
59
60
61
62
63
# File 'lib/generators/active_record/templates/migration.rb', line 2

def self.change

  create_table :pacioli_companies, :force => true do |t|
    t.integer :companyable_id
    t.string :companyable_type
    t.string :name

    t.timestamps
  end

  create_table :pacioli_parties, :force => true do |t|
    t.references :pacioli_company
    t.integer :partyable_id
    t.string :partyable_type
    t.string :type
    t.string :name

    t.timestamps
  end

  create_table :pacioli_accounts, :force => true do |t|
    t.references :pacioli_company
    t.string :code
    t.string :name
    t.string :description
    t.string :type

    t.timestamps
  end

  create_table :pacioli_journal_entries, :force => true do |t|
    t.string :journal_type
    t.string :description
    t.references :pacioli_company
    t.decimal :amount, :precision => 20, :scale => 10

    t.integer :source_documentable_id
    t.string :source_documentable_type

    t.datetime :dated, default: Time.now
    t.timestamps
  end

  create_table :pacioli_transactions, :force => true do |t|
    t.references :pacioli_journal_entry
    t.references :pacioli_account
    t.references :pacioli_party

    t.string :type
    t.decimal :amount, :precision => 20, :scale => 10

    t.datetime :dated, default: Time.now
    t.timestamps
  end

  create_table :pacioli_posting_rules, :force => true do |t|
    t.references :pacioli_company
    t.string :name
    t.text :rules
  end

end