cours0708/P5B/ruby/mon_projet/db/migrate/004_create_addresses.rb

18 lines
442 B
Ruby
Raw Normal View History

2008-11-25 21:11:16 +00:00
class CreateAddresses < ActiveRecord::Migration
def self.up
db_name = ActiveRecord::Base::connection.current_database()
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
create_table :addresses do |t|
t.column :street, :text
t.column :postal_code, :string
t.column :city, :string
t.column :country, :string
end
end
def self.down
drop_table :addresses
end
end