diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2010-07-26 14:06:14 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2010-09-03 22:59:09 +0200 |
commit | 75f8ac6ea71e4b2337f870b91ac05df98f33a8d2 (patch) | |
tree | b3fe95ec53958ce38a2b5fe23e7878dafd675b92 /activerecord/lib/rails | |
parent | 2068b8cb6a8508fae9cd1a7f57e68d938c6403e6 (diff) | |
download | rails-75f8ac6ea71e4b2337f870b91ac05df98f33a8d2.tar.gz rails-75f8ac6ea71e4b2337f870b91ac05df98f33a8d2.tar.bz2 rails-75f8ac6ea71e4b2337f870b91ac05df98f33a8d2.zip |
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
Diffstat (limited to 'activerecord/lib/rails')
-rw-r--r-- | activerecord/lib/rails/generators/active_record.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/lib/rails/generators/active_record.rb b/activerecord/lib/rails/generators/active_record.rb index 26bc977e19..4b3d1db216 100644 --- a/activerecord/lib/rails/generators/active_record.rb +++ b/activerecord/lib/rails/generators/active_record.rb @@ -14,6 +14,12 @@ module ActiveRecord def self.base_root File.dirname(__FILE__) end + + # Implement the required interface for Rails::Generators::Migration. + def self.next_migration_number(dirname) #:nodoc: + next_migration_number = current_migration_number(dirname) + 1 + ActiveRecord::Migration.next_migration_number(next_migration_number) + end end end end |