commit melhorias sgf
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Shared\Installation;
|
||||
|
||||
use Illuminate\Database\PostgresConnection;
|
||||
|
||||
/** Compatibility at installation time only; runtime business connections are untouched. */
|
||||
final class CompositionSchemaConnection extends PostgresConnection
|
||||
{
|
||||
public string $originalPermissionCheck;
|
||||
public ?CompositionSchemaBuilder $compositionBuilder=null;
|
||||
|
||||
public function getSchemaBuilder()
|
||||
{
|
||||
$this->useDefaultSchemaGrammar();
|
||||
return $this->compositionBuilder??=new CompositionSchemaBuilder($this);
|
||||
}
|
||||
|
||||
public function statement($query,$bindings=[])
|
||||
{
|
||||
// Older migrations replaced the permission whitelist. Preserve its original
|
||||
// branches as well as the migration's additions, without granting any right.
|
||||
if(preg_match('/^ALTER TABLE permission_grants ADD CONSTRAINT permission_grants_scope_check CHECK \((.*)\)$/s',$query,$m)){
|
||||
$query='ALTER TABLE permission_grants ADD CONSTRAINT permission_grants_scope_check CHECK (('.$this->originalPermissionCheck.') OR ('.$m[1].'))';
|
||||
}
|
||||
return parent::statement($query,$bindings);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user