#! /usr/bin/env ruby -Ku
#
# 2008-06-06 katoy
#
# See
#  http://jp.rubyist.net/magazine/?cmd=view&p=0006-RubyOnRails&key=activerecord
#  http://dev.ariel-networks.com/articles/workshop/rails-activerecord

require 'rubygems'
require 'active_record'

ActiveRecord::Base.default_timezone = :utc
# logger = ActiveRecord::Base.logger = Logger.new(STDOUT)

ActiveRecord::Base.configurations = YAML.load_file('database.yml')
ActiveRecord::Base.establish_connection('development')

# ActiveRecord::Base.connection.execute 'CREATE TABLE users (
#                               id INTEGER PRIMARY KEY AUTOINCREMENT,
#                               name TEXT,
#                              occupation TEXT)'

class MyMigration < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.string :name
      t.string :occupation
    end
  end

  def self.down
    drop_table :users
  end
end

MyMigration.down
MyMigration.up
