Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added a migration generator

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 2694b8cf276b52644495dc678436a10d9f8cee6d 1 parent 996fa15
@dhh dhh authored
View
9 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
View
7 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
Please sign in to comment.
Something went wrong with that request. Please try again.