From 2694b8cf276b52644495dc678436a10d9f8cee6d Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 22 Jun 2005 10:09:01 +0000 Subject: Added a migration generator git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../generators/components/migration/migration_generator.rb | 9 +++++++++ .../generators/components/migration/templates/migration.rb | 7 +++++++ 2 files changed, 16 insertions(+) create mode 100644 railties/lib/rails_generator/generators/components/migration/migration_generator.rb create mode 100644 railties/lib/rails_generator/generators/components/migration/templates/migration.rb (limited to 'railties/lib/rails_generator') 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 -- cgit v1.2.3