Skip to content

πŸ’¨ Provides a good starting point for production-ready SQLite databases

License

Notifications You must be signed in to change notification settings

nunomaduro/laravel-optimize-database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Skeleton Php

GitHub Workflow Status (main) Total Downloads Latest Version License


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:

πŸš€ 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.