Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11.x Support #33

Merged
merged 6 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ If you discover a security vulnerability within the package, please send an emai
Here is the list of project versions that are currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
|---------| ------------------ |
| 1.x.x | :x: |
| 2.x.x | :x: |
| 3.x.x | :white_check_mark: |
| 3.x.x | :x: |
| 4.x.x | :white_check_mark: |
| 5.x.x | :white_check_mark: |
8 changes: 4 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1]
laravel: [10.*]
php: [8.2]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand Down
48 changes: 26 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "orptech/laravel-migration-partition",
"description": "Laravel extensions for creating migrations with partitions.",
"description": "Laravel extensions that extends Illuminate to enable partitioned table creation within Laravel migrations.",
"keywords": [
"ORPTech",
"ORPtech",
"laravel",
"migrations",
"database",
"postgres",
"postgre",
"psql",
"laravel-migration-partition"
],
"homepage": "https://github.com/orptech/laravel-migration-partition",
Expand All @@ -12,31 +17,30 @@
{
"name": "Arda Karaderi",
"email": "[email protected]",
"role": "Developer"
"role": "Software Engineer"
}
],
"require": {
"php": "^8.1",
"doctrine/dbal": "^3.4",
"illuminate/contracts": "^10.0",
"illuminate/database": "^10.0",
"illuminate/support": "^10.0",
"illuminate/console":"^10.0",
"illuminate/filesystem":"^10.0",
"spatie/laravel-package-tools": "^1.13.0"
"php": "^8.2",
"illuminate/contracts": "^11.0",
"illuminate/database": "^11.0",
"illuminate/support": "^11.0",
"illuminate/console":"^11.0",
"illuminate/filesystem":"^11.0",
"spatie/laravel-package-tools": "^1.16.0"
},
"require-dev": {
"laravel/pint": "^1.0",
"nunomaduro/collision": "^6.0",
"nunomaduro/larastan": "^2.0.1",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^1.21",
"pestphp/pest-plugin-laravel": "^1.1",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.5",
"spatie/laravel-ray": "^1.26"
"laravel/pint": "^1.14",
"nunomaduro/collision": "^8.1.1",
"larastan/larastan": "^2.9",
"orchestra/testbench": "^9.0.0",
"pestphp/pest": "^2.34",
"pestphp/pest-plugin-arch": "^2.7",
"pestphp/pest-plugin-laravel": "^2.3",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"spatie/laravel-ray": "^1.35"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 7 additions & 0 deletions src/Commands/ListTablePartitionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ class ListTablePartitionsCommand extends Command
*
* @var string
*/
protected $description = 'Lists partitions for a table.';

/**
* The target table.
*
* @var string
*/
protected string $table;


Expand Down
85 changes: 43 additions & 42 deletions src/Database/Schema/Blueprint.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ORPTech\MigrationPartition\Database\Schema;

use Illuminate\Database\Schema\Blueprint as IlluminateBlueprint;
use Illuminate\Support\Fluent;

class Blueprint extends IlluminateBlueprint
{
Expand All @@ -11,98 +12,98 @@ class Blueprint extends IlluminateBlueprint
*
* @var string
*/
public $pkCompositeOne;
public string $pkCompositeOne;

/**
* Column key two for creating a composite key for range partitioned table.
*
* @var string
*/
public $pkCompositeTwo;
public string $pkCompositeTwo;

/**
* Partition range key for creating a range partitioned table.
*
* @var string
*/
public $rangeKey;
public string $rangeKey;

/**
* Partition range key for creating a range partitioned table.
*
* @var string
*/
public $suffixForPartition;
public string $suffixForPartition;

/**
* Partition range key for creating a range partitioned table.
*
* @var string
*/
public $startDate;
public string $startDate;

/**
* Partition range key for creating a range partitioned table.
*
* @var string
*/
public $endDate;
public string $endDate;

/**
* Column key for creating a table with list partition.
*
* @var string
*/
public $listPartitionKey;
public string $listPartitionKey;

/**
* Column key for creating list partitions.
*
* @var string
*/
public $listPartitionValue;
public string $listPartitionValue;

/**
* Column key for creating a table with hash partition.
*
* @var string
*/
public $hashPartitionKey;
public string $hashPartitionKey;

/**
* Hashing modulus for creating a hash partition.
*
* @var int
*/
public $hashModulus;
public int $hashModulus;

/**
* Hashing reminder for creating a hash partition.
*
* @var int
*/
public $hashRemainder;
public int $hashRemainder;

/**
* Column key for creating a table with list partition.
*
* @var string
*/
public $partitionTableName;
public string $partitionTableName;

/**
* List of commands that trigger the creating function.
*
* @var array
*/
private $creators = ['create', 'createRangePartitioned', 'createListPartitioned', 'createHashPartitioned'];
private array $creators = ['create', 'createRangePartitioned', 'createListPartitioned', 'createHashPartitioned'];

/**
* Determine if the blueprint has a create command.
*
* @return bool
*/
public function creating()
public function creating(): bool
{
return collect($this->commands)->contains(function ($command) {
return in_array($command->name, $this->creators, false);
Expand All @@ -112,137 +113,137 @@ public function creating()
/**
* Indicate that the table needs to be created with a range partition.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createRangePartitioned()
public function createRangePartitioned(): Fluent
{
return $this->addCommand('createRangePartitioned');
}

/**
* Create a range partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createRangePartition()
public function createRangePartition(): Fluent
{
return $this->addCommand('createRangePartition');
}

/**
* Attach a range partition for existing table to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function attachRangePartition()
public function attachRangePartition(): Fluent
{
return $this->addCommand('attachRangePartition');
}

/**
* Indicate that the table needs to be created with a list partition.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createListPartitioned()
public function createListPartitioned(): Fluent
{
return $this->addCommand('createListPartitioned');
}

/**
* Attach a range partition for existing table to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function attachListPartition()
public function attachListPartition(): Fluent
{
return $this->addCommand('attachListPartition');
}

/**
* Create a list partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createListPartition()
public function createListPartition(): Fluent
{
return $this->addCommand('createListPartition');
}

/**
* Indicate that the table needs to be created with a hash partition.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createHashPartitioned()
public function createHashPartitioned(): Fluent
{
return $this->addCommand('createHashPartitioned');
}

/**
* Create a hash partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function createHashPartition()
public function createHashPartition(): Fluent
{
return $this->addCommand('createHashPartition');
}
/**
* Attach a range partition for existing table to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function attachHashPartition()
public function attachHashPartition(): Fluent
{
return $this->addCommand('attachHashPartition');
}

/**
* Create a hash partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function getAllRangePartitionedTables()
public function getAllRangePartitionedTables(): Fluent
{
return $this->addCommand('getAllRangePartitionedTables');
}

/**
* Create a hash partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function getAllHashPartitionedTables()
public function getAllHashPartitionedTables(): Fluent
{
return $this->addCommand('getAllHashPartitionedTables');
}

/**
* Create a hash partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function getAllListPartitionedTables()
public function getAllListPartitionedTables(): Fluent
{
return $this->addCommand('getAllListPartitionedTables');
}

/**
* Create a hash partition and attach it to the partitioned table.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function getPartitions()
public function getPartitions(): Fluent
{
return $this->addCommand('getPartitions');
}
/**
* Indicate that the table needs to be created with a range partition.
*
* @return \Illuminate\Support\Fluent
* @return Fluent
*/
public function detachPartition()
public function detachPartition(): Fluent
{
return $this->addCommand('detachPartition');
}
Expand Down
Loading