1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 16:54:05 +00:00

finally fixed the migrations issue

This commit is contained in:
Samuel Štancl 2019-08-15 21:37:46 +02:00
parent 170392f15f
commit f7ca2937fd
5 changed files with 32 additions and 16 deletions

View file

@ -24,14 +24,8 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
Redis::connection('tenancy')->flushdb();
Redis::connection('cache')->flushdb();
// $this->loadLaravelMigrations();
Artisan::call('migrate:install');
// $this->loadMigrationsFrom(realpath(__DIR__ . '/../src/assets/migrations'));
// Artisan::call('migrate:fresh', [
// '--path' => __DIR__ . '/../src/assets/migrations'
// ]);
config(['database.default' => 'central']);
$this->loadMigrationsFrom(realpath(__DIR__ . '/../src/assets/migrations'));
if ($this->autoCreateTenant) {
$this->createTenant();
@ -64,6 +58,8 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
\Dotenv\Dotenv::create(__DIR__ . '/..')->load();
}
fclose(fopen(database_path('central.sqlite'), 'w'));
$app['config']->set([
'database.redis.cache.host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
'database.redis.default.host' => env('TENANCY_TEST_REDIS_HOST', '127.0.0.1'),
@ -77,6 +73,10 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
'database' => env('TENANCY_TEST_REDIS_DB', 14),
'prefix' => 'abc', // todo unrelated to tenancy, but this doesn't seem to have an effect? try to replicate in a fresh laravel installation
],
'database.connections.central' => [
'driver' => 'sqlite',
'database' => database_path('central.sqlite'),
],
'tenancy.database' => [
'based_on' => 'sqlite',
'prefix' => 'tenant',