diff --git a/src/Bootstrappers/CacheTenancyBootstrapper.php b/src/Bootstrappers/CacheTenancyBootstrapper.php index 0d948591..20e09816 100644 --- a/src/Bootstrappers/CacheTenancyBootstrapper.php +++ b/src/Bootstrappers/CacheTenancyBootstrapper.php @@ -101,19 +101,19 @@ class CacheTenancyBootstrapper implements TenancyBootstrapper if ($this->config->get('tenancy.cache.scope_sessions', true)) { // These are the only cache driven session backends (see Laravel's config/session.php) - if (! in_array($this->config->get('session.driver'), ['redis', 'memcached', 'dynamodb', 'apc'], true) - && ! app()->environment('local') - ) { - // We only throw this exception in prod to make configuration a little easier. Developers - // may have scope_sessions set to true while using different session drivers e.g. in tests. - // Previously we just silently ignored this, however since session scoping is of high importance - // in production, we make sure to notify the developer, by throwing an exception, that session - // scoping isn't happening as expected/configured due to an incompatible session driver. - throw new Exception('Session driver [' . $this->config->get('session.driver') . '] cannot be scoped by tenancy.cache.scope_session'); + if (! in_array($this->config->get('session.driver'), ['redis', 'memcached', 'dynamodb', 'apc'], true)) { + if (app()->environment('production')) { + // We only throw this exception in prod to make configuration a little easier. Developers + // may have scope_sessions set to true while using different session drivers e.g. in tests. + // Previously we just silently ignored this, however since session scoping is of high importance + // in production, we make sure to notify the developer, by throwing an exception, that session + // scoping isn't happening as expected/configured due to an incompatible session driver. + throw new Exception('Session driver [' . $this->config->get('session.driver') . '] cannot be scoped by tenancy.cache.scope_session'); + } + } else { + // Scoping sessions using this bootstrapper implicitly adds the session store to $names + $names[] = $this->getSessionCacheStoreName(); } - - // Scoping sessions using this bootstrapper implicitly adds the session store to $names - $names[] = $this->getSessionCacheStoreName(); } $names = array_unique($names); diff --git a/src/Database/TenantDatabaseManagers/SQLiteDatabaseManager.php b/src/Database/TenantDatabaseManagers/SQLiteDatabaseManager.php index 898a30bc..295cf304 100644 --- a/src/Database/TenantDatabaseManagers/SQLiteDatabaseManager.php +++ b/src/Database/TenantDatabaseManagers/SQLiteDatabaseManager.php @@ -79,6 +79,7 @@ class SQLiteDatabaseManager implements TenantDatabaseManager $name = '_tenancy_inmemory_' . $tenant->getTenantKey(); $tenant->setInternal('db_name', "file:$name?mode=memory&cache=shared"); + $tenant->save(); return true; }