From 47fb158b59be504d1091cfd6b7940dc89b7ca640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20=C5=A0tancl?= Date: Sat, 17 Aug 2019 16:33:22 +0200 Subject: [PATCH] Use MySQL by default; create migrations/tenant in tenancy:install --- assets/config.php | 2 +- src/Commands/Install.php | 13 ++++++++++--- tests/CommandsTest.php | 1 + 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/assets/config.php b/assets/config.php index b8f27925..1904f1dd 100644 --- a/assets/config.php +++ b/assets/config.php @@ -19,7 +19,7 @@ return [ // 'localhost', ], 'database' => [ - 'based_on' => 'sqlite', + 'based_on' => 'mysql', 'prefix' => 'tenant', 'suffix' => '', ], diff --git a/src/Commands/Install.php b/src/Commands/Install.php index a2f162e5..141f2bc8 100644 --- a/src/Commands/Install.php +++ b/src/Commands/Install.php @@ -41,8 +41,9 @@ class Install extends Command )); $this->info('✔️ Set middleware priority'); - \file_put_contents(base_path('routes/tenant.php'), -"info('✔️ Created routes/tenant.php'); $this->line(''); @@ -71,6 +73,11 @@ Route::get('/your/application/homepage', function () { $this->info('✔️ Created migration.'); } + if (! \is_dir(database_path('migrations/tenant'))) { + mkdir(database_path('migrations/tenant')); + $this->info('✔️ Created database/migrations/tenant folder.'); + } + $this->comment('✨️ stancl/tenancy installed successfully.'); } } diff --git a/tests/CommandsTest.php b/tests/CommandsTest.php index 8f2825e7..f1e6e4d5 100644 --- a/tests/CommandsTest.php +++ b/tests/CommandsTest.php @@ -213,6 +213,7 @@ class Kernel extends HttpKernel $this->assertFileExists(base_path('routes/tenant.php')); $this->assertFileExists(base_path('config/tenancy.php')); $this->assertFileExists(database_path('migrations/2019_08_08_000000_create_tenants_table.php')); + $this->assertDirectoryExists(database_path('migrations/tenant')); $this->assertSame("