diff --git a/app/models/account.rb b/app/models/account.rb new file mode 100644 index 000000000..e1db234ba --- /dev/null +++ b/app/models/account.rb @@ -0,0 +1,4 @@ +class Account < ActiveRecord::Base + belongs_to :registrar + CASH = 'cash' +end diff --git a/app/models/account_activity.rb b/app/models/account_activity.rb new file mode 100644 index 000000000..9392d1aef --- /dev/null +++ b/app/models/account_activity.rb @@ -0,0 +1,4 @@ +class AccountActivity < ActiveRecord::Base + belongs_to :account +end + diff --git a/db/migrate/20150410124724_create_accounts.rb b/db/migrate/20150410124724_create_accounts.rb new file mode 100644 index 000000000..d630f0ef1 --- /dev/null +++ b/db/migrate/20150410124724_create_accounts.rb @@ -0,0 +1,15 @@ +class CreateAccounts < ActiveRecord::Migration + def change + create_table :accounts do |t| + t.integer :registrar_id + t.string :account_type + t.decimal :balance + + t.timestamps + end + + Registrar.all.each do |x| + Account.create(registrar_id: x.id, account_type: Account::CASH) + end + end +end diff --git a/db/migrate/20150410132037_create_account_activities.rb b/db/migrate/20150410132037_create_account_activities.rb new file mode 100644 index 000000000..4ccba49df --- /dev/null +++ b/db/migrate/20150410132037_create_account_activities.rb @@ -0,0 +1,13 @@ +class CreateAccountActivities < ActiveRecord::Migration + def change + create_table :account_activites do |t| + t.integer :account_id + t.integer :invoice_id + t.decimal :amount + t.string :currency + t.integer :bank_transaction_id + + t.timestamps + end + end +end diff --git a/db/migrate/20150413080832_create_bank_transactions.rb b/db/migrate/20150413080832_create_bank_transactions.rb new file mode 100644 index 000000000..392833b7b --- /dev/null +++ b/db/migrate/20150413080832_create_bank_transactions.rb @@ -0,0 +1,22 @@ +class CreateBankTransactions < ActiveRecord::Migration + def change + create_table :bank_transactions do |t| + t.integer :bank_statement_id + t.string :subject_code + # record_code # kirjetunnus - ei kasuta? # impordime ainult tehingud nagunii + t.string :bank_reference # panga viide + t.string :tr_code # tehingu liik (MK / MV) + t.string :iban # own bank account no. + t.string :currency + t.string :other_party_bank + t.string :other_party_name + t.string :doc_no + t.string :description + #tr_type # C/D # impordime ainult cre nagunii + t.decimal :amount + t.string :reference_no + + t.timestamps + end + end +end diff --git a/db/migrate/20150413102310_create_bank_statements.rb b/db/migrate/20150413102310_create_bank_statements.rb new file mode 100644 index 000000000..fba842ac8 --- /dev/null +++ b/db/migrate/20150413102310_create_bank_statements.rb @@ -0,0 +1,14 @@ +class CreateBankStatements < ActiveRecord::Migration + def change + create_table :bank_statements do |t| + t.string :subject_code + t.string :bank_code + t.string :account_number + t.date :date + t.time :time + t.string :import_file_path + + t.timestamps + end + end +end diff --git a/db/migrate/20150413115829_create_banklink_transactions.rb b/db/migrate/20150413115829_create_banklink_transactions.rb new file mode 100644 index 000000000..ff85d5164 --- /dev/null +++ b/db/migrate/20150413115829_create_banklink_transactions.rb @@ -0,0 +1,27 @@ +class CreateBanklinkTransactions < ActiveRecord::Migration + def change + create_table :banklink_transactions do |t| + t.string :vk_service + t.string :vk_version + t.string :vk_snd_id + t.string :vk_rec_id + t.string :vk_stamp + t.string :vk_t_no + t.decimal :vk_amount + t.string :vk_curr + t.string :vk_rec_acc + t.string :vk_rec_name + t.string :vk_snd_acc + t.string :vk_snd_name + t.string :vk_ref + t.string :vk_msg + t.datetime :vk_t_datetime + t.string :vk_mac + t.string :vk_encoding + t.string :vk_lang + t.string :vk_auto + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2c707ef81..340f252ee 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,11 +11,29 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20150413140933) do +ActiveRecord::Schema.define(version: 20150413115829) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" + create_table "account_activites", force: :cascade do |t| + t.integer "account_id" + t.integer "invoice_id" + t.decimal "amount" + t.string "currency" + t.integer "bank_transaction_id" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "accounts", force: :cascade do |t| + t.integer "registrar_id" + t.string "account_type" + t.decimal "balance" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "addresses", force: :cascade do |t| t.integer "contact_id" t.string "city" @@ -45,6 +63,58 @@ ActiveRecord::Schema.define(version: 20150413140933) do t.string "updator_str" end + create_table "bank_statements", force: :cascade do |t| + t.string "subject_code" + t.string "bank_code" + t.string "account_number" + t.date "date" + t.time "time" + t.string "import_file_path" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "bank_transactions", force: :cascade do |t| + t.integer "bank_statement_id" + t.string "subject_code" + t.string "bank_reference" + t.string "tr_code" + t.string "iban" + t.string "currency" + t.string "other_party_bank" + t.string "other_party_name" + t.string "doc_no" + t.string "description" + t.decimal "amount" + t.string "reference_no" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "banklink_transactions", force: :cascade do |t| + t.string "vk_service" + t.string "vk_version" + t.string "vk_snd_id" + t.string "vk_rec_id" + t.string "vk_stamp" + t.string "vk_t_no" + t.decimal "vk_amount" + t.string "vk_curr" + t.string "vk_rec_acc" + t.string "vk_rec_name" + t.string "vk_snd_acc" + t.string "vk_snd_name" + t.string "vk_ref" + t.string "vk_msg" + t.datetime "vk_t_datetime" + t.string "vk_mac" + t.string "vk_encoding" + t.string "vk_lang" + t.string "vk_auto" + t.datetime "created_at" + t.datetime "updated_at" + end + create_table "cached_nameservers", id: false, force: :cascade do |t| t.string "hostname", limit: 255 t.string "ipv4", limit: 255