Sha256: 0ffb091fd57642aa628e30e2a99c4fb3cf8659640abf96322c842fdc1a0b8343

Contents?: true

Size: 852 Bytes

Versions: 4

Compression:

Stored size: 852 Bytes

Contents

# http://nithinbekal.com/posts/safe-rake-tasks

namespace :strong_migrations do
  task safety_assured: :environment do
    raise "Set SAFETY_ASSURED=1 to run this task in production" if Rails.env.production? && !ENV["SAFETY_ASSURED"]
  end

  # https://www.pgrs.net/2008/03/13/alphabetize-schema-rb-columns/
  task :alphabetize_columns do
    $stderr.puts "Dumping schema"
    ActiveRecord::Base.logger.level = Logger::INFO

    require "strong_migrations/alphabetize_columns"
    ActiveRecord::Base.connection.class.prepend StrongMigrations::AlphabetizeColumns
    if ActiveRecord::ConnectionAdapters.const_defined?('PostGISAdapter')
      ActiveRecord::ConnectionAdapters::PostGISAdapter.prepend StrongMigrations::AlphabetizeColumns
    end
    ActiveRecord::ConnectionAdapters::AbstractAdapter.prepend StrongMigrations::AlphabetizeColumns
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
strong_migrations-0.4.0 lib/tasks/strong_migrations.rake
strong_migrations-0.3.1 lib/tasks/strong_migrations.rake
strong_migrations-0.3.0 lib/tasks/strong_migrations.rake
strong_migrations-0.2.3 lib/tasks/strong_migrations.rake