Sha256: 81b9219f31f4705342ce3e8ce99f65b4be6b524e61d6a3d0ffe7c0c19eb5ddcd

Contents?: true

Size: 1.44 KB

Versions: 12

Compression:

Stored size: 1.44 KB

Contents

namespace :activerecord do
  namespace :shard_for do
    desc 'Show all defined clusters and their detail'
    task info: %i(environment) do
      ActiveRecord::ShardFor::DatabaseTasks.info
    end

    desc 'Setup all databases in all clusters'
    task setup: %i(create_all load_schema_all) do
    end

    desc 'Create all databases in all clusters'
    task :create_all => :environment do
      ActiveRecord::ShardFor::DatabaseTasks.invoke_task_for_all_clusters('create')
    end

    desc 'Drop all databases in all clusters'
    task :drop_all => :environment do
      ActiveRecord::ShardFor::DatabaseTasks.invoke_task_for_all_clusters('drop')
    end

    desc 'Load schema to all databases in all clusters'
    task :load_schema_all => :environment do
      ActiveRecord::ShardFor::DatabaseTasks.invoke_task_for_all_clusters('load_schema')
    end

    desc 'Create all databases in specific cluster'
    task :create, %i(cluster_name) => %i(environment) do |_, args|
      ActiveRecord::ShardFor::DatabaseTasks.create_all_databases(args)
    end

    desc 'Drop all databases in specific cluster'
    task :drop, %i(cluster_name) => %i(environment) do |_, args|
      ActiveRecord::ShardFor::DatabaseTasks.drop_all_databases(args)
    end

    desc 'Load schema to all databases in specific cluster'
    task :load_schema, %i(cluster_name) => %i(environment) do |_, args|
      ActiveRecord::ShardFor::DatabaseTasks.load_schema_all_databases(args)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
activerecord-shard_for-0.7.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.6.1 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.6.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.5.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.4.1 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.4.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.3.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.2.1 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.2.0 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.1.2 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.1.1 lib/activerecord/tasks/activerecord_shard_for.rake
activerecord-shard_for-0.1.0 lib/activerecord/tasks/activerecord_shard_for.rake