mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 09:14:03 +00:00
remove version checks
This commit is contained in:
parent
121370ea01
commit
fa09e3a083
3 changed files with 7 additions and 12 deletions
|
|
@ -62,14 +62,11 @@ class QueueTenancyBootstrapper implements TenancyBootstrapper
|
|||
static::initializeTenancyForQueue($event->job->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
|
||||
if (version_compare(app()->version(), '8.64', '>=')) {
|
||||
// JobRetryRequested only exists since Laravel 8.64
|
||||
$dispatcher->listen(JobRetryRequested::class, function ($event) use (&$previousTenant) {
|
||||
$previousTenant = tenant();
|
||||
$dispatcher->listen(JobRetryRequested::class, function ($event) use (&$previousTenant) {
|
||||
$previousTenant = tenant();
|
||||
|
||||
static::initializeTenancyForQueue($event->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
}
|
||||
static::initializeTenancyForQueue($event->payload()['tenant_id'] ?? null);
|
||||
});
|
||||
|
||||
// If we're running tests, we make sure to clean up after any artisan('queue:work') calls
|
||||
$revertToPreviousState = function ($event) use (&$previousTenant, $runningTests) {
|
||||
|
|
|
|||
|
|
@ -30,13 +30,13 @@ test('batch repository is set to tenant connection and reverted', function () {
|
|||
|
||||
tenancy()->initialize($tenant);
|
||||
expect(getBatchRepositoryConnectionName())->toBe('tenant');
|
||||
|
||||
|
||||
tenancy()->initialize($tenant2);
|
||||
expect(getBatchRepositoryConnectionName())->toBe('tenant');
|
||||
|
||||
tenancy()->end();
|
||||
expect(getBatchRepositoryConnectionName())->toBe('central');
|
||||
})->skip(fn() => version_compare(app()->version(), '8.0', '<'), 'Job batches are only supported in Laravel 8+');
|
||||
});
|
||||
|
||||
function getBatchRepositoryConnectionName()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -154,9 +154,7 @@ test('schema manager uses schema to separate tenant dbs', function () {
|
|||
]);
|
||||
tenancy()->initialize($tenant);
|
||||
|
||||
$schemaConfig = version_compare(app()->version(), '9.0', '>=') ?
|
||||
config('database.connections.' . config('database.default') . '.search_path') :
|
||||
config('database.connections.' . config('database.default') . '.schema');
|
||||
$schemaConfig = config('database.connections.' . config('database.default') . '.search_path');
|
||||
|
||||
expect($schemaConfig)->toBe($tenant->database()->getName());
|
||||
expect(config(['database.connections.pgsql.database']))->toBe($originalDatabaseName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue