cours0708/P5B/ruby/3dossmanno_annuaire/db/migrate/001_create_utilisateurs.rb

24 lines
630 B
Ruby
Raw Permalink Normal View History

2008-11-25 21:11:16 +00:00
class CreateUtilisateurs < ActiveRecord::Migration
db_name = ActiveRecord::Base::connection.current_database()
execute "ALTER DATABASE #{db_name} CHARACTER SET utf8 COLLATE utf8_general_ci"
def self.up
create_table :utilisateurs do |t|
t.column :nom, :string
t.column :prenom, :string
t.column :classe, :string
t.column :email, :string
t.column :age, :int[3]
t.column :rue, :string
t.column :codePostal, :int[5]
t.column :ville, :string
t.column :photo, :image
t.column :type, :string
end
end
def self.down
drop_table :utilisateurs
end
end