Skip to content

Commit

Permalink
Changed the attach keyword to init keyword per @denizgolbas's keyword…
Browse files Browse the repository at this point in the history
…ing request.
  • Loading branch information
ArdaKaraderi committed Oct 9, 2022
1 parent c65aa08 commit 976b33a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Schema::createHashPartitioned('[YourTableNameHere]', function (Blueprint $table)
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachRangePartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[StartDate]', '[EndDate]');
Schema::initRangePartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[StartDate]', '[EndDate]');
```

#### List Partition
Expand All @@ -98,7 +98,7 @@ Schema::attachRangePartition('[YourCreatedPartitionTableNameHere]', function (Bl
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachListPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[listPartitionValue]');
Schema::initListPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[listPartitionValue]');
```

#### Hash Partition
Expand All @@ -107,7 +107,7 @@ Schema::attachListPartition('[YourCreatedPartitionTableNameHere]', function (Blu
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachHashPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[hashModulus]', '[hashRemainder]');
Schema::initHashPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[hashModulus]', '[hashRemainder]');
```

## Testing
Expand Down
12 changes: 6 additions & 6 deletions src/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ public function createRangePartitioned()
*
* @return \Illuminate\Support\Fluent
*/
public function attachRangePartition()
public function initRangePartition()
{
return $this->addCommand('attachRangePartition');
return $this->addCommand('initRangePartition');
}

/**
Expand All @@ -137,9 +137,9 @@ public function createListPartitioned()
*
* @return \Illuminate\Support\Fluent
*/
public function attachListPartition()
public function initListPartition()
{
return $this->addCommand('attachListPartition');
return $this->addCommand('initListPartition');
}

/**
Expand All @@ -157,8 +157,8 @@ public function createHashPartitioned()
*
* @return \Illuminate\Support\Fluent
*/
public function attachHashPartition()
public function initHashPartition()
{
return $this->addCommand('attachHashPartition');
return $this->addCommand('initHashPartition');
}
}
6 changes: 3 additions & 3 deletions src/Database/Schema/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function createRangePartitioned(string $table, Closure $callback, string
* @param string $endDate
* @return void
*/
public function attachRangePartition(string $table, Closure $callback, string $subfixForPartition, string $startDate, string $endDate)
public function initRangePartition(string $table, Closure $callback, string $subfixForPartition, string $startDate, string $endDate)
{
$this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback, $subfixForPartition, $startDate, $endDate) {
$blueprint->attachRangePartition();
Expand Down Expand Up @@ -91,7 +91,7 @@ public function createListPartitioned(string $table, Closure $callback, string $
* @param string $listPartitionValue
* @return void
*/
public function attachListPartition(string $table, Closure $callback, string $subfixForPartition, string $listPartitionValue)
public function initListPartition(string $table, Closure $callback, string $subfixForPartition, string $listPartitionValue)
{
$this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback, $subfixForPartition, $listPartitionValue) {
$blueprint->attachListPartition();
Expand Down Expand Up @@ -134,7 +134,7 @@ public function createHashPartitioned(string $table, Closure $callback, string $
* @param int $hashRemainder
* @return void
*/
public function attachHashPartition(string $table, Closure $callback, string $subfixForPartition, int $hashModulus, int $hashRemainder)
public function initHashPartition(string $table, Closure $callback, string $subfixForPartition, int $hashModulus, int $hashRemainder)
{
$this->build(tap($this->createBlueprint($table), function ($blueprint) use ($callback, $subfixForPartition, $hashModulus, $hashRemainder) {
$blueprint->attachHashPartition();
Expand Down
6 changes: 3 additions & 3 deletions src/Database/Schema/Grammars/PostgresGrammar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function compileCreateRangePartitioned(Blueprint $blueprint, Fluent $comm
* @param \Illuminate\Support\Fluent $command
* @return array
*/
public function compileAttachRangePartition(Blueprint $blueprint, Fluent $command)
public function compileInitRangePartition(Blueprint $blueprint, Fluent $command)
{
return array_values(array_filter(array_merge([sprintf('create table %s_%s partition of %s for values from (\'%s\') to (\'%s\')',
str_replace("\"", "", $this->wrapTable($blueprint)),
Expand Down Expand Up @@ -63,7 +63,7 @@ public function compileCreateListPartitioned(Blueprint $blueprint, Fluent $comma
* @param \Illuminate\Support\Fluent $command
* @return array
*/
public function compileAttachListPartition(Blueprint $blueprint, Fluent $command)
public function compileInitListPartition(Blueprint $blueprint, Fluent $command)
{
return array_values(array_filter(array_merge([sprintf('create table %s_%s partition of %s for values in (\'%s\')',
str_replace("\"", "", $this->wrapTable($blueprint)),
Expand Down Expand Up @@ -95,7 +95,7 @@ public function compileCreateHashPartitioned(Blueprint $blueprint, Fluent $comma
* @param \Illuminate\Support\Fluent $command
* @return array
*/
public function compileAttachHasPartition(Blueprint $blueprint, Fluent $command)
public function compileInitHasPartition(Blueprint $blueprint, Fluent $command)
{
return array_values(array_filter(array_merge([sprintf('create table %s_%s partition of %s for values with (modulus %s, remainder %s)',
str_replace("\"", "", $this->wrapTable($blueprint)),
Expand Down
6 changes: 3 additions & 3 deletions src/Support/Facades/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

/**
* @method static createRangePartitioned(string $table, \Closure $callback, string $pkCompositeOne, string $pkCompositeTwo, string $rangeKey)
* @method static attachRangePartition(string $table, \Closure $callback, string $subfixForPartition, string $startDate, string $endDate)
* @method static initRangePartition(string $table, \Closure $callback, string $subfixForPartition, string $startDate, string $endDate)
* @method static createListPartitioned(string $table, \Closure $callback, string $pkCompositeOne, string $pkCompositeTwo, string $listPartitionKey)
* @method static attachListPartition(string $table, \Closure $callback, string $subfixForPartition, string $listPartitionValue)
* @method static initListPartition(string $table, \Closure $callback, string $subfixForPartition, string $listPartitionValue)
* @method static createHashPartitioned(string $table, \Closure $callback, string $pkCompositeOne, string $pkCompositeTwo, string $hashPartitionKey)
* @method static attachHashPartition(string $table, \Closure $callback, string $subfixForPartition, int $hashModulus, int $hashRemainder)
* @method static initHashPartition(string $table, \Closure $callback, string $subfixForPartition, int $hashModulus, int $hashRemainder)
* @see \ORPTech\MigrationPartition\Database\Schema\Builder
*/
class Schema extends Facade
Expand Down

0 comments on commit 976b33a

Please sign in to comment.