Une ou deux migrations
Ruby
code posted
created at 05 Jan 15:24
Edit
|
Back
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
class CreateVoitures < ActiveRecord::Migration def self.up create_table :voitures do |t| t.string :immatriculation t.string :marque t.string :modele t.string :couleur t.timestamps end end def self.down drop_table :voitures end end class AddMarqueIdToVoiture < ActiveRecord::Migration def self.up add_column :voitures, :marque_id, :integer end def self.down remove_column :voitures, :marque_id end end |
497 Bytes in 2 ms with coderay