Skip to content

Commit e1cc2e1

Browse files
authored
Merge pull request #17 from denizgolbas/main
Update PostgresGrammar.php
2 parents 1948cb4 + ef6b06e commit e1cc2e1

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/Database/Schema/Grammars/PostgresGrammar.php

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class PostgresGrammar extends IlluminatePostgresGrammar
1111
/**
1212
* Compile a create table command with its range partitions.
1313
*
14-
* @param Blueprint $blueprint
14+
* @param Blueprint $blueprint
1515
* @param Fluent $command
1616
* @return array
1717
*/
@@ -27,7 +27,7 @@ public function compileCreateRangePartitioned(Blueprint $blueprint, Fluent $comm
2727
/**
2828
* Compile a create table partition command for a range partitioned table.
2929
*
30-
* @param Blueprint $blueprint
30+
* @param Blueprint $blueprint
3131
* @param Fluent $command
3232
* @return array
3333
*/
@@ -45,7 +45,7 @@ public function compileCreateRangePartition(Blueprint $blueprint, Fluent $comman
4545
/**
4646
* Compile an attach partition command for a range partitioned table.
4747
*
48-
* @param Blueprint $blueprint
48+
* @param Blueprint $blueprint
4949
* @param Fluent $command
5050
* @return array
5151
*/
@@ -62,40 +62,40 @@ public function compileAttachRangePartition(Blueprint $blueprint, Fluent $comman
6262
/**
6363
* Compile a create table command with its list partitions.
6464
*
65-
* @param Blueprint $blueprint
65+
* @param Blueprint $blueprint
6666
* @param Fluent $command
6767
* @return array
6868
*/
6969
public function compileCreateListPartitioned(Blueprint $blueprint, Fluent $command)
7070
{
71-
return array_values(array_filter(array_merge([sprintf('create table %s (%s) partition by list(%s)',
71+
return sprintf('create table %s (%s) partition by list(%s)',
7272
$this->wrapTable($blueprint),
7373
sprintf('%s, %s', implode(', ', $this->getColumns($blueprint)), sprintf('primary key (%s, %s)', $blueprint->pkCompositeOne, $blueprint->pkCompositeTwo)),
7474
$blueprint->listPartitionKey
75-
)], $this->compileAutoIncrementStartingValues($blueprint))));
75+
);
7676
}
7777

7878
/**
7979
* Compile a create table partition command for a list partitioned table.
8080
*
81-
* @param Blueprint $blueprint
81+
* @param Blueprint $blueprint
8282
* @param Fluent $command
8383
* @return array
8484
*/
8585
public function compileCreateListPartition(Blueprint $blueprint, Fluent $command)
8686
{
87-
return array_values(array_filter(array_merge([sprintf('create table %s_%s partition of %s for values in (\'%s\')',
87+
return sprintf('create table %s_%s partition of %s for values in (\'%s\')',
8888
str_replace("\"", "", $this->wrapTable($blueprint)),
8989
$blueprint->suffixForPartition,
9090
str_replace("\"", "", $this->wrapTable($blueprint)),
9191
$blueprint->listPartitionValue,
92-
)], $this->compileAutoIncrementStartingValues($blueprint))));
92+
);
9393
}
9494

9595
/**
9696
* Compile an attach partition command for a list partitioned table.
9797
*
98-
* @param Blueprint $blueprint
98+
* @param Blueprint $blueprint
9999
* @param Fluent $command
100100
* @return array
101101
*/
@@ -111,7 +111,7 @@ public function compileAttachListPartition(Blueprint $blueprint, Fluent $command
111111
/**
112112
* Compile a create table command with its hash partitions.
113113
*
114-
* @param Blueprint $blueprint
114+
* @param Blueprint $blueprint
115115
* @param Fluent $command
116116
* @return array
117117
*/
@@ -127,25 +127,26 @@ public function compileCreateHashPartitioned(Blueprint $blueprint, Fluent $comma
127127
/**
128128
* Compile a create table partition command for a hash partitioned table.
129129
*
130-
* @param Blueprint $blueprint
130+
* @param Blueprint $blueprint
131131
* @param Fluent $command
132132
* @return array
133133
*/
134134
public function compileCreateHashPartition(Blueprint $blueprint, Fluent $command)
135135
{
136-
return array_values(array_filter(array_merge([sprintf('create table %s_%s partition of %s for values with (modulus %s, remainder %s)',
136+
return sprintf('create table %s_%s partition of %s for values with (modulus %s, remainder %s)',
137137
str_replace("\"", "", $this->wrapTable($blueprint)),
138138
$blueprint->suffixForPartition,
139139
str_replace("\"", "", $this->wrapTable($blueprint)),
140140
$blueprint->hashModulus,
141-
$blueprint->hashRemainder,
142-
)], $this->compileAutoIncrementStartingValues($blueprint))));
141+
$blueprint->hashRemainder
142+
);
143+
143144
}
144145

145146
/**
146147
* Compile an attach partition command for a hash partitioned table.
147148
*
148-
* @param Blueprint $blueprint
149+
* @param Blueprint $blueprint
149150
* @param Fluent $command
150151
* @return array
151152
*/
@@ -161,12 +162,12 @@ public function compileAttachHashPartition(Blueprint $blueprint, Fluent $command
161162

162163
/**
163164
* Get a list of all partitioned tables in the Database.
164-
* @param string $table
165+
* @param string $table
165166
* @return string
166167
*/
167168
public function compileGetPartitions(string $table)
168169
{
169-
return sprintf("SELECT inhrelid::regclass as tables
170+
return sprintf("SELECT inhrelid::regclass as tables
170171
FROM pg_catalog.pg_inherits
171172
WHERE inhparent = '%s'::regclass;",
172173
$table,
@@ -203,7 +204,7 @@ public function compileGetAllHashPartitionedTables()
203204
/**
204205
* Compile a detach query for a partitioned table.
205206
*
206-
* @param Blueprint $blueprint
207+
* @param Blueprint $blueprint
207208
* @param Fluent $command
208209
* @return array
209210
*/

0 commit comments

Comments
 (0)