Sha256: c803d7a29a12b6a679019e2277e3673bb2752500237031cccd85be47f8a5b911

Contents?: true

Size: 491 Bytes

Versions: 2

Compression:

Stored size: 491 Bytes

Contents

namespace :db do
  desc "Reset the database"
  task localtower_reset: :environment do
    puts "Custom reset."

    ActiveRecord::Base.connection.tables.each do |table|
      ActiveRecord::Base.connection.drop_table(table)
    end

    models = Dir["#{Rails.root}/app/models/**/*.rb"].reject { |file_name| file_name['application_record.rb']}

    FileUtils.rm_rf(models)
    FileUtils.rm_rf(Dir["#{Rails.root}/db/migrate/*"])
    FileUtils.rm_rf(Dir["#{Rails.root}/db/schema.rb"])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
localtower-2.0.1 spec/dummy/lib/tasks/reset.rake
localtower-2.0.0 spec/dummy/lib/tasks/reset.rake