Sha256: addb0b2c5defafebac2e77d68559600fe26735feaff2dae7c293f5270e583179

Contents?: true

Size: 596 Bytes

Versions: 6

Compression:

Stored size: 596 Bytes

Contents

require 'rails/generators/sequel'

module Sequel
  module Generators
    class MigrationGenerator < Base
      argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"

      def create_migration_file
        set_local_assigns!
        migration_template 'migration.rb', "db/migrate/#{file_name}.rb"
      end

      protected

      attr_reader :migration_action

      def set_local_assigns!
        if file_name =~ /^(add|drop)_.*_(?:to|from)_(.*)/
          @migration_action = $1
          @table_name = $2.pluralize
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rails3_sequel-0.3.1 lib/rails/generators/sequel/migration/migration_generator.rb
rails3_sequel-0.3.0 lib/rails/generators/sequel/migration/migration_generator.rb
rails3_sequel-0.2.2 lib/rails/generators/sequel/migration/migration_generator.rb
rails3_sequel-0.2.1 lib/rails/generators/sequel/migration/migration_generator.rb
rails3_sequel-0.2.0 lib/rails/generators/sequel/migration/migration_generator.rb
rails3_sequel-0.1.0 lib/rails/generators/sequel/migration/migration_generator.rb