
1. SDP in Rails
2. Migrations
3. handelingen die daarbij worden verrciht
4. praktisch modelleren met de db
create, add, delete, modify, change the name, change the order of columns
class AddSsl < ActiveRecord::Migration
def self.up
add_column :accounts, :ssl_enabled, :boolean, :default => 1
end
def self.down
remove_column :accounts, :ssl_enabled
end
end
Example of a more complex migration that also needs to initialize data:
class AddSystemSettings < ActiveRecord::Migration
def self.up
create_table :system_settings do |t|
t.string :name
t.string :label
t.text :value
t.string :type
t.integer :position
end
SystemSetting.create :name => "notice", :label => "Use notice?", :value => 1
end
def self.down
drop_table :system_settings
end
end
See http://dizzy.co.uk/ruby_on_rails/cheatsheets/rails-migrations