Class: Alpha

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/statements/migrations/00_alpha.rb

Instance Method Summary collapse

Instance 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
# File 'lib/statements/migrations/00_alpha.rb', line 2

def change

  create_table :documents do |t|
    t.string :path
    t.string :md5, limit: 32

    t.timestamps null: true

    t.index :md5, unique: true
  end

  create_table :accounts do |t|
    t.string :name
    t.string :number

    t.timestamps null: true

    t.index [:name, :number], unique: true
  end

  create_table :transactions do |t|
    t.references :document
    t.references :account
    t.integer :document_line
    t.datetime :transacted_at, null: true
    t.datetime :posted_at, null: true
    t.string :description
    t.decimal :amount, precision: 13, scale: 2
    t.decimal :balance, precision: 13, scale: 2
    t.decimal :foreign_amount, precision: 13, scale: 2
    t.string :foreign_currency, limit: 3
    t.string :colour, limit: 20, default: 'white'

    t.string :checksum, limit: 40

    t.timestamps null: true

    t.index [:document_id, :document_line], unique: true
  end

end