diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 8bb331e..495a4fb 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -8,6 +8,7 @@ use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Database\Eloquent\Model; use Illuminate\Http\Request; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Gate; use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; @@ -29,7 +30,7 @@ class AppServiceProvider extends ServiceProvider #[Override] public function register(): void { - // Stub + $this->bootDatabase(); } /** @@ -48,6 +49,24 @@ public function boot(): void $this->bootRoute(); } + public function bootDatabase(): void + { + $connections = ['sqlite', 'cache_db', 'pulse_db', 'queue_db', 'telescope_db']; + foreach ($connections as $connection) { + DB::connection($connection) + ->statement( + ' + PRAGMA synchronous = NORMAL; + PRAGMA mmap_size = 134217728; -- 128 megabytes + PRAGMA cache_size = 1000000000; + PRAGMA foreign_keys = true; + PRAGMA busy_timeout = 5000; + PRAGMA temp_store = memory; + ' + ); + } + } + public function bootAuth(): void { $isAdminCallback = static fn (User $user) => $user->is_admin; diff --git a/database/migrations/2014_10_11_000000_init_sqlite.php b/database/migrations/2014_10_11_000000_init_sqlite.php index 4236c92..cf61051 100644 --- a/database/migrations/2014_10_11_000000_init_sqlite.php +++ b/database/migrations/2014_10_11_000000_init_sqlite.php @@ -15,13 +15,6 @@ public function up(): void ->statement( ' PRAGMA journal_mode = WAL; - PRAGMA synchronous = NORMAL; - PRAGMA journal_size_limit = 67108864; -- 64 megabytes - PRAGMA mmap_size = 134217728; -- 128 megabytes - PRAGMA cache_size = 1000000000; - PRAGMA foreign_keys = true; - PRAGMA busy_timeout = 5000; - PRAGMA temp_store = memory; COMMIT; ' );