PHPackages                             emiliosh/laravel-migration-partition - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. emiliosh/laravel-migration-partition

ActiveLibrary

emiliosh/laravel-migration-partition
====================================

Laravel extensions for creating migrations with partitions.

v1.1(2y ago)14MITPHPPHP ^8.1

Since Dec 1Pushed 2y agoCompare

[ Source](https://github.com/emiliosh/laravel-migration-partition)[ Packagist](https://packagist.org/packages/emiliosh/laravel-migration-partition)[ Docs](https://github.com/emiliosh/laravel-migration-partition)[ RSS](/packages/emiliosh-laravel-migration-partition/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (18)Versions (3)Used By (0)

[![](https://camo.githubusercontent.com/2517980964372c61e86022b23e1bd56d1903a8f62e8866085f5ab482354fa742/68747470733a2f2f6f7270746563682e636f6d2f6173736574732f696d616765732f6c6f676f732f6f7270746563682d6c6f676f2d77686974652e706e67)](https://orptech.com)

[![](https://camo.githubusercontent.com/e2e7c4f41a3bc71a73b3b6e7a9c802148ee71f2622cc865927c4f96be7b52fca/68747470733a2f2f726574726f636b65742e696f2f636f6d6d6f6e2f696d672f6c6f676f5f77686974652e706e67)](https://retrocket.io)

Database Partitions via Migrations for Laravel (aka Laravel Migration Partitions)
=================================================================================

[](#database-partitions-via-migrations-for-laravel-aka-laravel-migration-partitions)

This package extends Illuminate to provide partitioned table creation in migrations for PostgreSQL. Support for other DMBS's will be added soon.

[![Latest Version on Packagist](https://camo.githubusercontent.com/798c01c37c285cc873f67851bc68e2a03d70267329b5907181a9bea79d79874c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f7270746563682f6c61726176656c2d6d6967726174696f6e2d706172746974696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/orptech/laravel-migration-partition)[![Total Downloads](https://camo.githubusercontent.com/b24e1a91400644bae3a4bad81e8cfd930a55b1f0f99a4322dffae0fc6daa687f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f7270746563682f6c61726176656c2d6d6967726174696f6e2d706172746974696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/orptech/laravel-migration-partition)

ORPtech Software
----------------

[](#orptech-software)

We are ORPtech. Here at ORPtech, we pride ourselves in ensuring that clients and services have a peaceful, safe and smooth interaction. We know how difficult it is to build trust for a service, therefore we are here to help bridge the gaps within the market via our robust applications. Please contact us for further information on how our services might help your business.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require orptech/laravel-migration-partition
```

DBMS Support
------------

[](#dbms-support)

- PostgreSQL

### Planned Development

[](#planned-development)

- MySQL - Looking for Contributors
- MariaDB - Looking for Contributors
- SQL Server 2017+
- SQLite 3.8.8+

Usage
-----

[](#usage)

This package currently, only supports PostgreSQL.

PostgreSQL
----------

[](#postgresql)

PostgreSQL also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.

### Range Partitioning

[](#range-partitioning)

Instead of importing Illuminate's Schema import this package's schema:

```
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
```

Template Usage
--------------

[](#template-usage)

### Range Partition

[](#range-partition)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createRangePartitioned('[YourTableNameHere]', function (Blueprint $table) {
    //...
}, '[rangePartitionKey]');
```

##### Creating a Range Partition for a Partitioned Table

[](#creating-a-range-partition-for-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createRangePartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[startDate]', '[endDate]');
```

##### Attaching a Range Partition to a Partitioned Table

[](#attaching-a-range-partition-to-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachRangePartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[startDate]', '[endDate]');
```

### List Partition

[](#list-partition)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createListPartitioned('[YourTableNameHere]', function (Blueprint $table) {
    //...
}, '[listPartitionKey]');
```

##### Creating a List Partition for a Partitioned Table

[](#creating-a-list-partition-for-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createListPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[listPartitionValue]');
```

##### Attaching a List Partition to a Partitioned Table

[](#attaching-a-list-partition-to-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachListPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[listPartitionValue]');
```

### Hash Partition

[](#hash-partition)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createHashPartitioned('[YourTableNameHere]', function (Blueprint $table) {
    //...
}, '[hashPartitionKey]');
```

##### Creating a Hash Partition for a Partitioned Table

[](#creating-a-hash-partition-for-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::createHashPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[hashModulus]', '[hashRemainder]');
```

##### Attaching a Hash Partition to a Partitioned Table

[](#attaching-a-hash-partition-to-a-partitioned-table)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::attachHashPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[hashModulus]', '[hashRemainder]');
```

#### Removing a Partition

[](#removing-a-partition)

```
use ORPTech\MigrationPartition\Database\Schema\Blueprint;
use ORPTech\MigrationPartition\Support\Facades\Schema;

Schema::detachPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[partitionTableName]');
```

Commands
--------

[](#commands)

##### New Series of Range Partition Migrations

[](#new-series-of-range-partition-migrations)

This command will create a new series of migrations for all range partitioned tables.

```
php artisan partition:range
```

##### New Series of List Partition Migrations

[](#new-series-of-list-partition-migrations)

This command will create a new series of migrations for all list partitioned tables.

```
php artisan partition:list
```

##### New Series of Hash Partition Migrations

[](#new-series-of-hash-partition-migrations)

This command will create a new series of migrations for all hash partitioned tables.

```
php artisan partition:hash
```

##### Listing Partitions

[](#listing-partitions)

This command will list all the partitioned tables.

```
php artisan partition:partitions
```

### Important

[](#important)

- This package currently supports PostgreSQL Range Partitions.
- You shouldn't define any primary keys in your migration. The package creates a composite key while setting up the table.
- You need to create an initial partition to start using the tables. (PostgreSQL)

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [ORPtech](https://github.com/orptech-com)
- [Retrocket](https://github.com/retrocket)
- [Laravel](https://github.com/laravel)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 69% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

893d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b959e8c712ca3e1ffc7c624bdcb4948acef354f98a4656ba76a910252fcc7579?d=identicon)[emiliosh](/maintainers/emiliosh)

---

Top Contributors

[![ArdaKaraderi](https://avatars.githubusercontent.com/u/22325146?v=4)](https://github.com/ArdaKaraderi "ArdaKaraderi (40 commits)")[![denizgolbas](https://avatars.githubusercontent.com/u/27892099?v=4)](https://github.com/denizgolbas "denizgolbas (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![megasteve19](https://avatars.githubusercontent.com/u/32229751?v=4)](https://github.com/megasteve19 "megasteve19 (3 commits)")

---

Tags

laravelORPTechlaravel-migration-partition

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/emiliosh-laravel-migration-partition/health.svg)

```
[![Health](https://phpackages.com/badges/emiliosh-laravel-migration-partition/health.svg)](https://phpackages.com/packages/emiliosh-laravel-migration-partition)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
