From 96980bd561d79824b6cb6efbcbecdcbf8785d452 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 3 May 2008 11:29:47 -0500 Subject: Added change_table for migrations (Jeff Dean) [#71 state:resolved] --- activerecord/README | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'activerecord/README') diff --git a/activerecord/README b/activerecord/README index 7204b44ec4..ff3f55ee8a 100755 --- a/activerecord/README +++ b/activerecord/README @@ -164,6 +164,28 @@ A short rundown of the major features: ActiveRecord::Base.logger = Log4r::Logger.new("Application Log") +* Database agnostic schema management with Migrations + + 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 + + {Learn more}[link:classes/ActiveRecord/Migration.html] + == Simple example (1/2): Defining tables and classes (using MySQL) Data definitions are specified only in the database. Active Record queries the database for -- cgit v1.2.3