1 | <?php |
||
2 | |||
3 | namespace Staudenmeir\LaravelMigrationViews\Schema\Builders; |
||
4 | |||
5 | use Illuminate\Database\Schema\SQLiteBuilder as Base; |
||
6 | use Illuminate\Support\Str; |
||
7 | |||
8 | class SQLiteBuilder extends Base |
||
9 | { |
||
10 | use ManagesViews { |
||
11 | createView as createViewParent; |
||
12 | } |
||
13 | |||
14 | /** |
||
15 | * Create a new view on the schema. |
||
16 | * |
||
17 | * @param string $name |
||
18 | * @param \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Query\Builder|string $query |
||
19 | * @param array|null $columns |
||
20 | * @param bool $orReplace |
||
21 | * @param bool $materialized |
||
22 | * @return void |
||
23 | */ |
||
24 | public function createView($name, $query, ?array $columns = null, $orReplace = false, bool $materialized = false) |
||
0 ignored issues
–
show
|
|||
25 | { |
||
26 | if ($orReplace) { |
||
27 | $this->dropViewIfExists($name); |
||
28 | } |
||
29 | |||
30 | $this->createViewParent($name, $query, $columns); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * Rename a view on the schema. |
||
35 | * |
||
36 | * @param string $from |
||
37 | * @param string $to |
||
38 | * @return void |
||
39 | */ |
||
40 | public function renameView($from, $to) |
||
41 | { |
||
42 | $view = $this->connection->selectOne( |
||
43 | "select * from sqlite_master where type = 'view' and name = ?", |
||
44 | [$this->connection->getTablePrefix().$from] |
||
45 | ); |
||
46 | |||
47 | $this->dropView($from); |
||
48 | |||
49 | $query = Str::replaceFirst( |
||
50 | $this->grammar->wrapTable($from), |
||
51 | $this->grammar->wrapTable($to), |
||
52 | $view->sql |
||
53 | ); |
||
54 | |||
55 | $this->connection->statement($query); |
||
56 | } |
||
57 | } |
||
58 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.