{"id":15024887,"url":"https://github.com/orptech-com/laravel-migration-partition","last_synced_at":"2025-04-12T08:26:43.473Z","repository":{"id":60898220,"uuid":"546544528","full_name":"orptech-com/laravel-migration-partition","owner":"orptech-com","description":"This package extends Illuminate to enable partitioned table creation within Laravel migrations.","archived":false,"fork":false,"pushed_at":"2024-06-08T11:06:35.000Z","size":77,"stargazers_count":20,"open_issues_count":1,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-06-09T22:06:04.675Z","etag":null,"topics":["laravel","laravel-framework","laravel-package","mysql","partition","partitioning","postgres","postgresql"],"latest_commit_sha":null,"homepage":"https://orptech-com.github.io/laravel-migration-partition/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/orptech-com.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-06T08:45:14.000Z","updated_at":"2024-07-09T10:13:18.460Z","dependencies_parsed_at":"2024-03-23T21:21:46.160Z","dependency_job_id":"49c8ccdd-1bb6-40ed-aa6c-dda5684c12a7","html_url":"https://github.com/orptech-com/laravel-migration-partition","commit_stats":{"total_commits":36,"total_committers":5,"mean_commits":7.2,"dds":"0.38888888888888884","last_synced_commit":"53de547c489afb43071dc26605c26786c2e0fc03"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orptech-com%2Flaravel-migration-partition","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orptech-com%2Flaravel-migration-partition/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orptech-com%2Flaravel-migration-partition/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/orptech-com%2Flaravel-migration-partition/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/orptech-com","download_url":"https://codeload.github.com/orptech-com/laravel-migration-partition/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248538781,"owners_count":21121038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-framework","laravel-package","mysql","partition","partitioning","postgres","postgresql"],"created_at":"2024-09-24T20:01:07.670Z","updated_at":"2025-04-12T08:26:43.432Z","avatar_url":"https://github.com/orptech-com.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv\u003e\n    \u003cp align=\"center\"\u003e\u003ca href=\"https://orptech.com\" target=\"_blank\"\u003e\u003cimg src=\"https://orptech.com/assets/images/logos/orptech-logo-white.png\" width=\"150\"\u003e\u003c/a\u003e\u003c/p\u003e\n    \u003cp align=\"center\"\u003e\u003ca href=\"https://retrocket.io\" target=\"_blank\"\u003e\u003cimg src=\"https://retrocket.io/common/img/logo_white.png\" width=\"150\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n# Database Partitions via Migrations for Laravel (aka Laravel Migration Partitions)\nThis package extends Illuminate to provide partitioned table creation in migrations for PostgreSQL. Support for other DMBS's will be added soon.\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/orptech/laravel-migration-partition.svg?style=flat-square)](https://packagist.org/packages/orptech/laravel-migration-partition)\n[![Total Downloads](https://img.shields.io/packagist/dt/orptech/laravel-migration-partition.svg?style=flat-square)](https://packagist.org/packages/orptech/laravel-migration-partition)\n\n## ORPtech Software\n\nWe 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.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require orptech/laravel-migration-partition\n```\n\n## DBMS Support\n\n- PostgreSQL\n\n### Planned Development\n\n- MySQL - Looking for Contributors\n- MariaDB - Looking for Contributors\n- SQL Server 2017+\n- SQLite 3.8.8+\n\n## Usage\nThis package currently, only supports PostgreSQL.\n\n## PostgreSQL\nPostgreSQL also known as Postgres, is a free and open-source relational database management system (RDBMS) emphasizing extensibility and SQL compliance.\n\n### Range Partitioning \nInstead of importing Illuminate's Schema import this package's schema:\n```php\nuse Illuminate\\Database\\Schema\\Blueprint;\nuse Illuminate\\Support\\Facades\\Schema;\n```\n\n## Template Usage\n\n### Range Partition\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createRangePartitioned('[YourTableNameHere]', function (Blueprint $table) {\n    //...\n}, '[compositeKeyOne]', '[compositeKeyTwo]', '[rangePartitionKey]');\n```\n\n##### Creating a Range Partition for a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createRangePartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[startDate]', '[endDate]');\n```\n\n##### Attaching a Range Partition to a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::attachRangePartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[startDate]', '[endDate]');\n```\n\n### List Partition\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createListPartitioned('[YourTableNameHere]', function (Blueprint $table) {\n    //...\n}, '[compositeKeyOne]', '[compositeKeyTwo]', '[listPartitionKey]');\n```\n\n##### Creating a List Partition for a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createListPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[listPartitionValue]');\n```\n\n##### Attaching a List Partition to a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::attachListPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[listPartitionValue]');\n```\n\n### Hash Partition\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createHashPartitioned('[YourTableNameHere]', function (Blueprint $table) {\n    //...\n}, '[compositeKeyOne]', '[compositeKeyTwo]', '[hashPartitionKey]');\n```\n\n##### Creating a Hash Partition for a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::createHashPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[hashModulus]', '[hashRemainder]');\n```\n\n##### Attaching a Hash Partition to a Partitioned Table\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::attachHashPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[suffixForPartition]', '[hashModulus]', '[hashRemainder]');\n```\n\n#### Removing a Partition\n\n```php\nuse ORPTech\\MigrationPartition\\Database\\Schema\\Blueprint;\nuse ORPTech\\MigrationPartition\\Support\\Facades\\Schema;\n\nSchema::detachPartition('[YourPartitionedTableNameHere]', function (Blueprint $table) {}, '[partitionTableName]');\n```\n\n## Commands\n\n##### New Series of Range Partition Migrations\nThis command will create a new series of migrations for all range partitioned tables.\n```bash\nphp artisan partition:range\n```\n\n##### New Series of List Partition Migrations\nThis command will create a new series of migrations for all list partitioned tables.\n```bash\nphp artisan partition:list\n```\n\n##### New Series of Hash Partition Migrations\nThis command will create a new series of migrations for all hash partitioned tables.\n```bash\nphp artisan partition:hash\n```\n\n##### Listing Partitions\nThis command will list all the partitioned tables.\n```bash\nphp artisan partition:partitions\n```\n\n### Important\n- This package currently supports PostgreSQL Range Partitions.\n- You shouldn't define any primary keys in your migration. The package creates a composite key while setting up the table.\n- You need to create an initial partition to start using the tables. (PostgreSQL)\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [ORPtech](https://github.com/orptech-com)\n- [Retrocket](https://github.com/retrocket)\n- [Laravel](https://github.com/laravel)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forptech-com%2Flaravel-migration-partition","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Forptech-com%2Flaravel-migration-partition","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Forptech-com%2Flaravel-migration-partition/lists"}