diff --git a/CHANGELOG.md b/CHANGELOG.md index 127d2b7..ca049ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to `jonaspauleta/scout-postgres` are documented here. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.1] - 2026-08-07 + +### Changed + +- Allow calling `ignoreMigrations()` on the service provider to not automatically run. + ## [2.0.0] - 2026-07-09 ### Changed diff --git a/README.md b/README.md index 10f88c9..7897073 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,12 @@ Run migrations — the package migration is auto-loaded and creates the `pg_trgm php artisan migrate ``` +Publishing migrations (to run your own, you can call `ScoutPostgres\ScoutPostgresServiceProvider::ignoreMigrations()` in a boot method): + +```bash +php artisan vendor:publish --tag=scout-postgres-migrations +``` + ## Configuration Set Scout to use the `pgsql` engine in your `.env`: diff --git a/src/ScoutPostgresServiceProvider.php b/src/ScoutPostgresServiceProvider.php index dfa8392..dcd6aae 100644 --- a/src/ScoutPostgresServiceProvider.php +++ b/src/ScoutPostgresServiceProvider.php @@ -12,13 +12,18 @@ final class ScoutPostgresServiceProvider extends PackageServiceProvider { + private static bool $runsMigrations = true; + public function configurePackage(Package $package): void { $package ->name('scout-postgres') ->hasConfigFile('scout-postgres') - ->hasMigration('0000_01_01_000000_create_postgres_search_extensions') - ->runsMigrations(); + ->hasMigration('0000_01_01_000000_create_postgres_search_extensions'); + + if (self::$runsMigrations) { + $package->runsMigrations(); + } } public function packageBooted(): void @@ -31,4 +36,9 @@ public function packageBooted(): void $manager->extend('pgsql', fn () => $app->make(PostgresEngine::class)); }); } + + public static function ignoreMigrations(): void + { + self::$runsMigrations = false; + } }