diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-22 10:09:01 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-06-22 10:09:01 +0000 |
commit | 2694b8cf276b52644495dc678436a10d9f8cee6d (patch) | |
tree | 9085f30f13b8f8874e19b12a551775b72a927da1 | |
parent | 996fa1526dd238a12e1f6173090d8bcbbfd567d2 (diff) | |
download | rails-2694b8cf276b52644495dc678436a10d9f8cee6d.tar.gz rails-2694b8cf276b52644495dc678436a10d9f8cee6d.tar.bz2 rails-2694b8cf276b52644495dc678436a10d9f8cee6d.zip |
Added a migration generator
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/lib/rails_generator/generators/components/migration/migration_generator.rb | 9 | ||||
-rw-r--r-- | railties/lib/rails_generator/generators/components/migration/templates/migration.rb | 7 |
2 files changed, 16 insertions, 0 deletions
diff --git a/railties/lib/rails_generator/generators/components/migration/migration_generator.rb b/railties/lib/rails_generator/generators/components/migration/migration_generator.rb new file mode 100644 index 0000000000..d1f4d4c41b --- /dev/null +++ b/railties/lib/rails_generator/generators/components/migration/migration_generator.rb @@ -0,0 +1,9 @@ +class MigrationGenerator < Rails::Generator::NamedBase + def manifest + record do |m| + m.directory File.join('db/migrate') + next_migration_number = Dir.glob("db/migrate/[0-9]*.*").size + 1 + m.template 'migration.rb', File.join('db/migrate', "#{next_migration_number}_#{file_name}.rb") + end + end +end diff --git a/railties/lib/rails_generator/generators/components/migration/templates/migration.rb b/railties/lib/rails_generator/generators/components/migration/templates/migration.rb new file mode 100644 index 0000000000..9d0e53062f --- /dev/null +++ b/railties/lib/rails_generator/generators/components/migration/templates/migration.rb @@ -0,0 +1,7 @@ +class <%= class_name %> < ActiveRecord::Migration + def self.up + end + + def self.down + end +end |