Sha256: ee7dbbf72f9206ebbfb5cf8bc33e0a57f5c45eadd74b515058d9909f15450875

Contents?: true

Size: 790 Bytes

Versions: 15

Compression:

Stored size: 790 Bytes

Contents

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

module OldSql
  class InstallMigrationsGenerator < Rails::Generators::Base
    include Rails::Generators::Migration
    source_root File.expand_path('../templates', __FILE__)

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

    def create_migration_file
      migration_template 'add_old_sql_admin_to_users_migration.rb', 'db/migrate/add_old_sql_admin_to_users.rb' rescue p $!.message
      #sleep 1 # ensure scripts have different timestamps
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
old_sql-0.24.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.23.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.22.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.21.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.20.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.19.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.18.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.17.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.16.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.15.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.14.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.13.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.12.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.11.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-0.10.0 lib/generators/old_sql/install_migrations_generator.rb