Skip to content

Commit 4582ac7

Browse files
authored
Prevent database connection during boot when running migrations is disabled (#245)
* fix: prevent database connection during boot when `run_migrations` configuration is disabled * Pint --------- Co-authored-by: Boefjim <[email protected]>
1 parent 5ee8497 commit 4582ac7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/RedirectServiceProvider.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,9 @@ protected function bootRedirects(): self
250250
$connection = DB::getDefaultConnection();
251251
}
252252

253-
if (Schema::connection($connection)->hasTable('redirects')) {
254-
return $this;
255-
}
256-
257-
if (config('statamic.redirect.run_migrations')) {
253+
if (config('statamic.redirect.run_migrations')
254+
&& ! Schema::connection($connection)->hasTable('redirects')
255+
) {
258256
$defaultConnection = DB::getDefaultConnection();
259257
DB::setDefaultConnection($connection);
260258

0 commit comments

Comments
 (0)