Changeset 1278
- Timestamp:
- 10/26/06 21:29:44 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
experimental/restful/db/migrate/056_create_notifications.rb
r1275 r1278 1 1 class CreateNotifications < ActiveRecord::Migration 2 class OldNotification < ActiveRecord::Base 3 end 4 5 class Notification < ActiveRecord::Base 6 end 7 2 8 def self.up 9 rename_table :notifications, :old_notifications 10 3 11 create_table :notifications do |t| 4 # t.column :name, :string12 t.column :content_id, :integer 5 13 t.column :user_id, :integer 6 t.column :content_id, :integer 14 t.column :created_at, :datetime 15 t.column :updated_at, :datetime 7 16 end 17 18 OldNotification.reset_column_information 19 Notification.reset_column_information 20 if $schema_generator 21 OldNotification.find(:all).each do |on| 22 Notification.create!(on.attributes) 23 end 24 end 25 drop_table :old_notifications 8 26 end 9 27 10 28 def self.down 11 drop_table :notifications 29 remove_column :notifications, :id 30 rename_column :notifications, :user_id, :notify_user_id 31 rename_column :notifications, :content_id, :notify_content_id 12 32 end 13 33 end
