Sha256: 51fd2cbb546f9d361b5984ab41e9fd8f5bd9bb0983b58716c935566c7ac84e99

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

# This will generate a migration for your application.
# 
# Example without columns:
#   rake generate:migration name=create_users
# 
# db/migrations/<number>_create_users.rb:
#   class CreateUsers < ActiveRecord::Migration
#     self.up
#     end
# 
#     self.down
#     end
#   end
# 
# Example with columns:
#   rake generate:migration name=create_users cols=username:string,email_address:string,created_at:datetime,updated_at:datetime
# 
# db/migrations/<number>_create_users.rb:
#   class CreateUsers < ActiveRecord::Migration
#     self.up
#       create_table :users do |t|
#         t.column :username, :string
#         t.column :email_address, :string
#         t.column :created_at, :datetime
#         t.column :updated_at, :datetime
#     end
# 
#     self.down
#       drop_table :users
#     end
#   end
class MigrationGenerator < Genosaurus

  require_param :name
  
  def setup # :nodoc:
    @table_name = param(:name).underscore.plural.gsub("create_", "")
    @migration_name = "#{next_migration_number}_#{param(:name).underscore}"
  end
  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
mack-active_record-0.6.1.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.6.0.1 lib/migration_generator/migration_generator.rb
mack-active_record-0.6.0 lib/migration_generator/migration_generator.rb
mack-active_record-0.7.0.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.7.1.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.0.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.0.2 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.6.1.2 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.7.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.0 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.0.101 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.8.0.3 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.6.1 lib/mack-active_record/migration_generator/migration_generator.rb
mack-active_record-0.7.0 lib/mack-active_record/migration_generator/migration_generator.rb