From 75f8ac6ea71e4b2337f870b91ac05df98f33a8d2 Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Mon, 26 Jul 2010 14:06:14 +0200 Subject: Implemented ActiveRecord::Migrations#copy based on James Adam's idea ActiveRecord::Migration#copy allows to copy migrations from one place to another, changing migrations versions and adding scope to filename. For example: ActiveRecord::Migration.copy("db/migrate", :blog_engine => "vendor/gems/blog/db/migrate") will copy all migrations from vendor/gems/blog/db/migrate to db/migrate with such format: Versions of copied migrations will be reversioned to be appended after migrations that already exists in db/migrate --- activerecord/test/migrations/to_copy/1_people_have_hobbies.rb | 9 +++++++++ .../test/migrations/to_copy/2_people_have_descriptions.rb | 9 +++++++++ 2 files changed, 18 insertions(+) create mode 100644 activerecord/test/migrations/to_copy/1_people_have_hobbies.rb create mode 100644 activerecord/test/migrations/to_copy/2_people_have_descriptions.rb (limited to 'activerecord/test/migrations/to_copy') diff --git a/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb new file mode 100644 index 0000000000..639841f663 --- /dev/null +++ b/activerecord/test/migrations/to_copy/1_people_have_hobbies.rb @@ -0,0 +1,9 @@ +class PeopleHaveLastNames < ActiveRecord::Migration + def self.up + add_column "people", "hobbies", :text + end + + def self.down + remove_column "people", "hobbies" + end +end diff --git a/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb new file mode 100644 index 0000000000..b3d0b30640 --- /dev/null +++ b/activerecord/test/migrations/to_copy/2_people_have_descriptions.rb @@ -0,0 +1,9 @@ +class PeopleHaveLastNames < ActiveRecord::Migration + def self.up + add_column "people", "description", :text + end + + def self.down + remove_column "people", "description" + end +end -- cgit v1.2.3