Skip to content

Commit

Permalink
If database is not set up we should not update
Browse files Browse the repository at this point in the history
  • Loading branch information
riasvdv committed Jan 8, 2024
1 parent 372e1ab commit ba5c921
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/UpdateScripts/RenameLocaleToSiteOnRedirectsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

namespace Rias\StatamicRedirect\UpdateScripts;

use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Schema;
use Statamic\UpdateScripts\UpdateScript;

class RenameLocaleToSiteOnRedirectsTable extends UpdateScript
{
public function shouldUpdate($newVersion, $oldVersion)
{
return Schema::hasColumn('redirects', 'locale');
try {
return Schema::hasColumn('redirects', 'locale');
} catch (QueryException) {
// Query exception happens when database is not set up
return false;
}
}

public function update()
Expand Down

0 comments on commit ba5c921

Please sign in to comment.