diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-05-03 11:29:47 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-05-03 11:29:47 -0500 |
commit | 96980bd561d79824b6cb6efbcbecdcbf8785d452 (patch) | |
tree | 66c4d506c883dbebf628c7bed020b704980d6729 /activerecord/README | |
parent | 64092de25727c1943807bf5345107d90428135a0 (diff) | |
download | rails-96980bd561d79824b6cb6efbcbecdcbf8785d452.tar.gz rails-96980bd561d79824b6cb6efbcbecdcbf8785d452.tar.bz2 rails-96980bd561d79824b6cb6efbcbecdcbf8785d452.zip |
Added change_table for migrations (Jeff Dean) [#71 state:resolved]
Diffstat (limited to 'activerecord/README')
-rwxr-xr-x | activerecord/README | 22 |
1 files changed, 22 insertions, 0 deletions
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 |