Multiple tenant architecture setup for sidekiq and rake task

When using multiple database setup in rails we have commands like this. bin/rails db:migrate:db_name

what if I need to run a rake task on a particular db.

example → bin/rake one_time_tasks is there something I can pass database variable here? which will help me in not writing additional code in rake task itself.

also, what are current scenarios of setting a sidekiq job in background with a setup like this.

config.active_record.shard_selector = { lock: true }
  config.active_record.shard_resolver = ->(request) {
    request.env['HTTP_HOST'] == 'some_url' ? 'default' : 'db2'


  connects_to shards: {
    default: { writing: :db1},
    db2: { writing: :db2 }

what is best way to schedule sidekiq jobs in this case. I do not want to go with bruteforce approach of passing database name in each sidekiq job.