Sha256: b0e4735a0e5e7d94c41e5eb74429266380c9b2476cb0040620fffe9d92c314bc

Contents?: true

Size: 632 Bytes

Versions: 19

Compression:

Stored size: 632 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'

module Unread
  class MigrationGenerator < Rails::Generators::Base
    include Rails::Generators::Migration

    desc "Generates migration for read_markers"
    source_root File.expand_path('../templates', __FILE__)

    def create_migration_file
      migration_template 'migration.rb', 'db/migrate/unread_migration.rb'
    end

    def self.next_migration_number(dirname)
      if ActiveRecord::Base.timestamped_migrations
        Time.now.utc.strftime("%Y%m%d%H%M%S")
      else
        "%.3d" % (current_migration_number(dirname) + 1)
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
unread-0.13.0 lib/generators/unread/migration/migration_generator.rb
unread-0.12.0 lib/generators/unread/migration/migration_generator.rb
unread-0.11.0 lib/generators/unread/migration/migration_generator.rb
unread-0.10.1 lib/generators/unread/migration/migration_generator.rb
unread-0.10.0 lib/generators/unread/migration/migration_generator.rb
unread-0.9.1 lib/generators/unread/migration/migration_generator.rb
unread-0.9.0 lib/generators/unread/migration/migration_generator.rb
unread-0.8.3 lib/generators/unread/migration/migration_generator.rb
unread-0.8.2 lib/generators/unread/migration/migration_generator.rb
unread-0.8.1 lib/generators/unread/migration/migration_generator.rb
unread-0.8.0 lib/generators/unread/migration/migration_generator.rb
unread-0.7.1 lib/generators/unread/migration/migration_generator.rb
unread-0.7.0 lib/generators/unread/migration/migration_generator.rb
unread-0.6.3 lib/generators/unread/migration/migration_generator.rb
unread-0.6.2 lib/generators/unread/migration/migration_generator.rb
unread-0.6.1 lib/generators/unread/migration/migration_generator.rb
unread-0.6.0 lib/generators/unread/migration/migration_generator.rb
unread-0.5.0 lib/generators/unread/migration/migration_generator.rb
unread-0.4.0 lib/generators/unread/migration/migration_generator.rb