cours0708/P5B/ruby/3dossmanno_annuaire/db/migrate/001_create_utilisateurs.rb
2008-11-25 22:11:16 +01:00

24 lines
630 B
Ruby

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