Sha256: ae351f9c9efe5ecb72a0e9e3112b3cca1e698f203870d63d538167d0b0f2e981

Contents?: true

Size: 979 Bytes

Versions: 1

Compression:

Stored size: 979 Bytes

Contents

# frozen_string_literal: true

namespace :db do
  namespace :mongoid do
    task :load_models do
    end

    desc "Create the indexes defined on your mongoid models"
    task :create_indexes => [:environment, :load_models] do
      ::Mongoid::Tasks::Database.create_indexes
    end

    desc "Remove indexes that exist in the database but aren't specified on the models"
    task :remove_undefined_indexes => [:environment, :load_models] do
      ::Mongoid::Tasks::Database.remove_undefined_indexes
    end

    desc "Remove the indexes defined on your mongoid models without questions!"
    task :remove_indexes => [:environment, :load_models] do
      ::Mongoid::Tasks::Database.remove_indexes
    end

    desc "Drops the default client database"
    task :drop => :environment do
      ::Mongoid::Clients.default.database.drop
    end

    desc "Drop all collections except the system collections"
    task :purge => :environment do
      ::Mongoid.purge!
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid-7.1.0.rc0 lib/mongoid/tasks/database.rake