nunomaduro/laravel-optimize-database
ๅ ณไบ
๐จ Provides a good starting point for production-ready SQLite databases
ๆฐๆฎไธๅๆๅฎๆตๆๆ ๅข้ฟ
- 24ๅฐๆถ
- 0
- 7ๅคฉ
- 0
- 15ๅคฉ
- -1
- 1ไธชๆ
- ๆญฃๅจๆถ้ๅๅฒ
ๅๅจๆๅ ็ๆๆ ๅๅๅ๏ผๅจๆ็ธไบ้ๅ ๏ผๅนถ้ๆฏๆฅๆฐๅขใ็ผบๅคฑ็ๆต้ไฟๆ็ฉบ็ฝใๆๆ ไปฃ่กจๅ ณๆณจๅบฆ๏ผไธไปฃ่กจ่ฝฏไปถ่ดจ้ใ
README.md
ๅๆ
This package is a work-in-progress, therefore you should not use it in production - and always backup your database before requiring it through Composer.
This package provides a simple way to optimize your SQLite database in Laravel; it's a good starting point for production-ready SQLite databases. At the time of this writing, it applies the following settings:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ Setting โ Value โ Via โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโผโโโโโโโโโโโโค
โ PRAGMA auto_vacuum โ incremental โ Migration โ
โ PRAGMA journal_mode โ WAL โ Migration โ
โ PRAGMA page_size โ 32768 โ Migration โ
โ PRAGMA busy_timeout โ 5000 โ Runtime โ
โ PRAGMA cache_size โ -20000 โ Runtime โ
โ PRAGMA foreign_keys โ ON โ Runtime โ
โ PRAGMA incremental_vacuum โ (enabled) โ Runtime โ
โ PRAGMA mmap_size โ 2147483648 โ Runtime โ
โ PRAGMA temp_store โ MEMORY โ Runtime โ
โ PRAGMA synchronous โ NORMAL โ Runtime โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโดโโโโโโโโโโโโ
The settings are applied in two ways:
- Migration Stub - Applied via migration.
- Runtime Configuration - Applied at runtime, via service provider.
๐ Installation
Requires PHP 8.2+, SQLite 3.46+ and Laravel 11.0+
You can install the package via Composer:
composer require nunomaduro/laravel-optimize-database
๐ Usage
To get started optimizing your SQLite database, you need to run the following command:
php artisan db:optimize
At this point, the [Runtime] settings are applied automatically. However, you need to run the migration to apply the [Migration] settings:
php artisan migrate
Laravel Optimize Database was created by Nuno Maduro under the MIT license.
ๆข็ดข็ธๅ ณ้กน็ฎ
ๅ ่ฝฝไธญโฆ