File tree 2 files changed +6
-4
lines changed 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,9 @@ protected function handle(DoctrineDBALView $view): void
16
16
{
17
17
$ this ->createViewSQL = $ this ->makeCreateViewSQL ($ this ->quotedName , $ view ->getSql ());
18
18
19
- if ($ view ->getNamespaceName () === DB ::connection ()->getConfig ('schema ' )) {
19
+ $ searchPath = DB ::connection ()->getConfig ('search_path ' ) ?: DB ::connection ()->getConfig ('schema ' );
20
+
21
+ if ($ view ->getNamespaceName () === $ searchPath ) {
20
22
// Strip namespace from name.
21
23
$ name = $ view ->getShortestName ($ view ->getNamespaceName ());
22
24
$ this ->name = $ this ->makeName ($ name );
Original file line number Diff line number Diff line change @@ -28,12 +28,12 @@ public function getTableNames(): Collection
28
28
}
29
29
30
30
// Schema name defined in the framework configuration.
31
- $ schema = DB ::connection ()->getConfig ('schema ' );
31
+ $ searchPath = DB :: connection ()-> getConfig ( ' search_path ' ) ?: DB ::connection ()->getConfig ('schema ' );
32
32
33
33
$ parts = explode ('. ' , $ table );
34
34
$ namespace = $ parts [0 ];
35
35
36
- return $ namespace === $ schema ;
36
+ return $ namespace === $ searchPath ;
37
37
})
38
38
->values ();
39
39
}
@@ -77,7 +77,7 @@ public function getViews(): Collection
77
77
78
78
// Start from Laravel 9, the `schema` configuration option used to configure Postgres connection search paths renamed to `search_path`.
79
79
// Fallback to `schema` if Laravel version is older than 9.
80
- $ searchPath = DB ::connection ()->getConfig ('search_path ' ) ?? DB ::connection ()->getConfig ('schema ' );
80
+ $ searchPath = DB ::connection ()->getConfig ('search_path ' ) ?: DB ::connection ()->getConfig ('schema ' );
81
81
82
82
return $ view ->getNamespaceName () === $ searchPath ;
83
83
})
You can’t perform that action at this time.
0 commit comments