has_accounts 0.17.1 → 0.17.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,71 @@
|
|
1
|
+
class CreateHasAccountsTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table "account_types" do |t|
|
4
|
+
t.string "name", :limit => 100
|
5
|
+
t.string "title", :limit => 100
|
6
|
+
t.datetime "created_at"
|
7
|
+
t.datetime "updated_at"
|
8
|
+
end
|
9
|
+
|
10
|
+
add_index "account_types", "name"
|
11
|
+
|
12
|
+
create_table "accounts" do |t|
|
13
|
+
t.string "title", :limit => 100
|
14
|
+
t.integer "parent_id"
|
15
|
+
t.integer "account_type_id"
|
16
|
+
t.integer "number"
|
17
|
+
t.string "code"
|
18
|
+
t.string "type"
|
19
|
+
t.integer "holder_id"
|
20
|
+
t.string "holder_type"
|
21
|
+
t.integer "bank_id"
|
22
|
+
t.integer "esr_id"
|
23
|
+
t.string "pc_id"
|
24
|
+
t.datetime "created_at"
|
25
|
+
t.datetime "updated_at"
|
26
|
+
t.string "iban"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_index "accounts", ["account_type_id"], :name => "index_accounts_on_account_type_id"
|
30
|
+
add_index "accounts", ["bank_id"], :name => "index_accounts_on_bank_id"
|
31
|
+
add_index "accounts", ["code"], :name => "index_accounts_on_code"
|
32
|
+
add_index "accounts", ["holder_id", "holder_type"], :name => "index_accounts_on_holder_id_and_holder_type"
|
33
|
+
add_index "accounts", ["type"], :name => "index_accounts_on_type"
|
34
|
+
|
35
|
+
create_table "banks" do |t|
|
36
|
+
t.integer "vcard_id"
|
37
|
+
t.string "swift"
|
38
|
+
t.string "clearing"
|
39
|
+
t.datetime "created_at"
|
40
|
+
t.datetime "updated_at"
|
41
|
+
end
|
42
|
+
|
43
|
+
add_index "banks", :vcard_id
|
44
|
+
|
45
|
+
create_table "bookings" do |t|
|
46
|
+
t.string "title", :limit => 100
|
47
|
+
t.decimal "amount"
|
48
|
+
t.integer "credit_account_id"
|
49
|
+
t.integer "debit_account_id"
|
50
|
+
t.date "value_date"
|
51
|
+
t.text "comments", :limit => 1000, :default => ""
|
52
|
+
t.string "scan"
|
53
|
+
t.string "debit_currency", :default => "CHF"
|
54
|
+
t.string "credit_currency", :default => "CHF"
|
55
|
+
t.float "exchange_rate", :default => 1.0
|
56
|
+
t.datetime "created_at"
|
57
|
+
t.datetime "updated_at"
|
58
|
+
t.integer "reference_id"
|
59
|
+
t.string "reference_type"
|
60
|
+
end
|
61
|
+
|
62
|
+
add_index "bookings", ["credit_account_id"], :name => "index_bookings_on_credit_account_id"
|
63
|
+
add_index "bookings", ["debit_account_id"], :name => "index_bookings_on_debit_account_id"
|
64
|
+
add_index "bookings", ["reference_id", "reference_type"], :name => "index_bookings_on_reference_id_and_reference_type"
|
65
|
+
add_index "bookings", ["value_date"], :name => "index_bookings_on_value_date"
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.down
|
69
|
+
drop_table :account_types, :accounts, :banks, :bookings
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class LegacyBank < ActiveRecord::Base
|
2
|
+
set_table_name 'banks'
|
3
|
+
end
|
4
|
+
|
5
|
+
class BankNowInheritsFromPerson < ActiveRecord::Migration
|
6
|
+
def up
|
7
|
+
add_column :people, :swift, :string
|
8
|
+
add_column :people, :clearing, :string
|
9
|
+
|
10
|
+
for bank in LegacyBank.all
|
11
|
+
vcard = Vcard.where(:object_type => 'Bank', :object_id => bank.id).first
|
12
|
+
person = Bank.create!(
|
13
|
+
:vcard => vcard,
|
14
|
+
:swift => bank.swift,
|
15
|
+
:clearing => bank.clearing
|
16
|
+
)
|
17
|
+
|
18
|
+
if vcard
|
19
|
+
vcard.object = person
|
20
|
+
vcard.save!
|
21
|
+
else
|
22
|
+
person.build_vcard.save
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
drop_table :banks
|
27
|
+
end
|
28
|
+
end
|
data/lib/has_accounts/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_accounts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 95
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 17
|
9
|
-
-
|
10
|
-
version: 0.17.
|
9
|
+
- 2
|
10
|
+
version: 0.17.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- "Simon H\xC3\xBCrlimann (CyT)"
|
@@ -93,6 +93,9 @@ files:
|
|
93
93
|
- app/models/bank_account.rb
|
94
94
|
- app/models/booking.rb
|
95
95
|
- config/locales/de.yml
|
96
|
+
- db/migrate/20111108000000_create_has_accounts_tables.rb
|
97
|
+
- db/migrate/20111109093857_use_string_for_account_number.rb
|
98
|
+
- db/migrate/20111230121259_bank_now_inherits_from_person.rb
|
96
99
|
- lib/has_accounts.rb
|
97
100
|
- lib/has_accounts/class_methods.rb
|
98
101
|
- lib/has_accounts/core_ext/rounding.rb
|