2008年3月10日 星期一

migration and rake

adjust database

ex:
class CreateStories < ActiveRecord::Migration
def self.up
create_table :stories do |t|
t.column :name, :string
t.column :link, :string
t.timestamps
end
end

def self.down
drop_table :stories
end
end

rake:
like make for C

to execute migration via rake:
rake db:migrate


create_table :stories, :force=>true do |t|
create the table even the table has been created by raw sql

沒有留言: