Skip to content

💨 Publishes migrations that make your sqlite database production ready. it's a work-in-progress

License

Notifications You must be signed in to change notification settings

veeqtoh/laravel-optimize-database

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Skeleton Php

GitHub Workflow Status (main) Total Downloads Latest Version License


This package is a work-in-progress, and the goal is to keep improving the migration stub: database/migrations/optimize_database_settings.php.stub. At the moment, it only supports SQLite, but I am open to adding support for other database types.

This package publish a migration that will apply good defaults to your SQLite database, making it faster and more production-ready.

Requires PHP 8.2+, SQLite 3.46+ and Laravel 11.0+

🚀 Installation

You can install the package via Composer:

composer require nunomaduro/laravel-optimize-database --dev

🙌 Usage

To optimize your SQLite database, you need to run the migration that this package provides:

php artisan db:optimize

This will publish a migration that apply defaults like so:

    public function up(): void
    {
        DB::statement('PRAGMA journal_mode = WAL');
        DB::statement('PRAGMA synchronous = NORMAL');
        DB::statement('PRAGMA page_size = 32768;');
        DB::statement('PRAGMA cache_size = -20000;');
        DB::statement('PRAGMA auto_vacuum = incremental;');
        DB::statement('PRAGMA foreign_keys = ON;');

        // etc...
    }

Next, you simply need to run the migration:

php artisan migrate

Laravel Optimize Database was created by Nuno Maduro under the MIT license.

About

💨 Publishes migrations that make your sqlite database production ready. it's a work-in-progress

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%