cartodb-4.29/lib/tasks/create_importer_schema.rake

21 lines
701 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
namespace :cartodb do
namespace :db do
desc 'Create importer schema and assign privileges to owner'
task :create_importer_schema => :environment do
count = ::User.count
::User.all.each_with_index do |user, index|
begin
puts "Creating importer schema for #{user.username}"
user.db_service.create_importer_schema
user.db_service.set_user_privileges_in_importer_schema
printf "OK %-#{20}s (%-#{4}s/%-#{4}s)\n", user.username, index, count
rescue => exception
printf "FAIL %-#{20}s (%-#{4}s/%-#{4}s) #{exception.message}\n", user.username, index, count
end
sleep(1.0/5.0)
end
end
end
end