Sha256: d5be8172e2d838e8d0548b645646a0d7dce830d9bbf743386fa110f4de07343d

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

#!/usr/bin/env ruby
# Requires PostgreSQL
# Setup the finance_development DB

require 'bundler'
Bundler.require

config = YAML.load_file('./database.yml')

ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres'))
ActiveRecord::Base.connection.create_database(config['database'])

ActiveRecord::Base.establish_connection(config)

ActiveRecord::Migration.create_table :accounts do |t|
  t.string :asset_liability
  t.string :account_type
  t.string :institution
end

ActiveRecord::Migration.create_table :dates do |t|
  t.integer :year
  t.integer :quarter
  t.integer :month
  t.integer :day
end

ActiveRecord::Migration.create_table :customers do |t|
  t.string :name
  t.string :gender
end

ActiveRecord::Migration.create_table :account_snapshots do |t|
  t.references :account
  t.references :date
  t.references :customer
  t.decimal :balance
end

require './domain'

account   = Dimensions::Account.create(:asset_liability => 'ASSET', :account_type => 'Savings', :institution => 'ACU - Awesome Credit Union')
customer  = Dimensions::Customer.create(:name => 'JohnnyT', :gender => 'Male')
date      = Dimesnions::Date.create(:year => 2012, :quarter => 4, :month => 11, :day => 31)

Facts::AccountSnapshot.create(:account => account, :customer => customer, :date => date, :balance => 100.00)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubiks-0.0.3 examples/finance/setup
rubiks-0.0.2 examples/finance/setup