Skip to content

Commit 738aeb3

Browse files
authored
fix: use correct database connection (#198)
1 parent a633c5d commit 738aeb3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/UpdateScripts/AddDescriptionColumnToRedirectsTable.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ class AddDescriptionColumnToRedirectsTable extends UpdateScript
1111
{
1212
public function shouldUpdate($newVersion, $oldVersion)
1313
{
14-
if (config('statamic.redirect.redirect_connection') === 'stache') {
14+
$connection = config('statamic.redirect.redirect_connection');
15+
16+
if ($connection === 'stache') {
1517
return false;
1618
}
1719

20+
if ($connection === 'default') {
21+
$connection = config('database.default');
22+
}
23+
1824
try {
19-
return ! Schema::connection(config('statamic.redirect.redirect_connection'))->hasColumn('redirects', 'description');
25+
return ! Schema::connection($connection)->hasColumn('redirects', 'description');
2026
} catch (QueryException) {
2127
// Query exception happens when database is not set up
2228
return false;
@@ -29,6 +35,6 @@ public function update()
2935
'--tag' => 'statamic-redirect-redirect-migrations',
3036
]);
3137

32-
$this->console()->info('New migration for Redirect description published, make sure to it!');
38+
$this->console()->info('New migration for Redirect description published, make sure to run it!');
3339
}
3440
}

0 commit comments

Comments
 (0)