@@ -44,28 +44,70 @@ use Illuminate\Support\Facades\Schema;
4444```
4545
4646### Template Usage
47+
48+ #### Range Partition
49+
4750``` php
4851use ORPTech\MigrationPartition\Database\Schema\Blueprint;
4952use ORPTech\MigrationPartition\Support\Facades\Schema;
5053
51- Schema::createPartitioned ('[YourTableNameHere]', function (Blueprint $table) {
54+ Schema::createRangePartitioned ('[YourTableNameHere]', function (Blueprint $table) {
5255 //...
5356}, '[compositeKeyOne]', '[compositeKeyTwo]', '[rangePartitionKey]');
5457```
5558
59+ #### List Partition
60+
61+ ``` php
62+ use ORPTech\MigrationPartition\Database\Schema\Blueprint;
63+ use ORPTech\MigrationPartition\Support\Facades\Schema;
64+
65+ Schema::createListPartitioned('[YourTableNameHere]', function (Blueprint $table) {
66+ //...
67+ }, '[compositeKeyOne]', '[compositeKeyTwo]', '[listPartitionKey]');
68+ ```
69+
70+ #### Hash Partition
71+
72+ ``` php
73+ use ORPTech\MigrationPartition\Database\Schema\Blueprint;
74+ use ORPTech\MigrationPartition\Support\Facades\Schema;
75+
76+ Schema::createHashPartitioned('[YourTableNameHere]', function (Blueprint $table) {
77+ //...
78+ }, '[compositeKeyOne]', '[compositeKeyTwo]', '[hashPartitionKey]');
79+ ```
80+
5681### Important
5782- This package currently supports PostgreSQL Range Partitions.
5883- You shouldn't define any primary keys in your migration. The package creates a composite key while setting up the table.
5984- You need to create an initial partition to start using the tables. (PostgreSQL)
6085
86+ #### Range Partition
87+
88+ ``` php
89+ use ORPTech\MigrationPartition\Database\Schema\Blueprint;
90+ use ORPTech\MigrationPartition\Support\Facades\Schema;
91+
92+ Schema::attachRangePartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[StartDate]', '[EndDate]');
93+ ```
94+
95+ #### List Partition
96+
6197``` php
62- Schema::attachPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[StartDate]', '[EndDate]');
98+ use ORPTech\MigrationPartition\Database\Schema\Blueprint;
99+ use ORPTech\MigrationPartition\Support\Facades\Schema;
100+
101+ Schema::attachListPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[listPartitionValue]');
63102```
64103
65- #### OR
104+ #### Hash Partition
66105
67106``` php
68- DB::statement("CREATE TABLE [partition_name_here] PARTITION OF [table_name_here] FOR VALUES FROM [starting_value_here] TO [end_value_here]");
107+ use ORPTech\MigrationPartition\Database\Schema\Blueprint;
108+ use ORPTech\MigrationPartition\Support\Facades\Schema;
109+
110+ Schema::attachHashPartition('[YourCreatedPartitionTableNameHere]', function (Blueprint $table) {}, '[SubfixForPartition]', '[hashModulus]', '[hashRemainder]');
69111```
70112
71113## Testing
0 commit comments