Sha256: 7e3270c3a368ba3f4b5fef88b02643d74da893bc868400d89e7e01d9d09d5b87

Contents?: true

Size: 847 Bytes

Versions: 73

Compression:

Stored size: 847 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
      sleep 1 # ensure scripts have different timestamps
      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

73 entries across 73 versions & 1 rubygems

Version Path
old_sql-1.37.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.36.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.35.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.34.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.33.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.32.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.31.1 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.30.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.29.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.28.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.27.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.26.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.25.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.24.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.23.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.22.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.21.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.20.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.19.0 lib/generators/old_sql/install_migrations_generator.rb
old_sql-1.18.0 lib/generators/old_sql/install_migrations_generator.rb