mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 20:14:03 +00:00
register dumcommand when L8
This commit is contained in:
parent
800f533011
commit
f165fc58ba
2 changed files with 21 additions and 1 deletions
|
|
@ -84,10 +84,16 @@ class TenancyServiceProvider extends ServiceProvider
|
||||||
Commands\Migrate::class,
|
Commands\Migrate::class,
|
||||||
Commands\Rollback::class,
|
Commands\Rollback::class,
|
||||||
Commands\TenantList::class,
|
Commands\TenantList::class,
|
||||||
Commands\TenantDump::class,
|
|
||||||
Commands\MigrateFresh::class,
|
Commands\MigrateFresh::class,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (version_compare(app()->version(), '8.0', '>=')) {
|
||||||
|
// DumpCommand only exists since Laravel 8.0 or above
|
||||||
|
$this->commands([
|
||||||
|
Commands\TenantDump::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
$this->publishes([
|
$this->publishes([
|
||||||
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
|
__DIR__ . '/../assets/config.php' => config_path('tenancy.php'),
|
||||||
], 'config');
|
], 'config');
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ test('migrate command works with tenants option', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('migrate command loads schema state', function () {
|
test('migrate command loads schema state', function () {
|
||||||
|
if (! isVersion8()) {
|
||||||
|
$this->markTestSkipped('DumpCommand only exists since Laravel 8.0 or above');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
|
|
||||||
expect(Schema::hasTable('schema_users'))->toBeFalse();
|
expect(Schema::hasTable('schema_users'))->toBeFalse();
|
||||||
|
|
@ -94,6 +99,10 @@ test('migrate command loads schema state', function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
test('dump command works', function () {
|
test('dump command works', function () {
|
||||||
|
if (! isVersion8()) {
|
||||||
|
$this->markTestSkipped('DumpCommand only exists since Laravel 8.0 or above');
|
||||||
|
}
|
||||||
|
|
||||||
$tenant = Tenant::create();
|
$tenant = Tenant::create();
|
||||||
Artisan::call('tenants:migrate');
|
Artisan::call('tenants:migrate');
|
||||||
|
|
||||||
|
|
@ -210,3 +219,8 @@ function databaseConnectionSwitchedToDefault()
|
||||||
|
|
||||||
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
expect(DB::connection()->getDatabaseName())->toBe($originalDBName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isVersion8(): bool
|
||||||
|
{
|
||||||
|
return version_compare(app()->version(), '8.0', '>=');
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue