Download the PHP package brokenice/laravel-mysql-partition without Composer
On this page you can find all versions of the php package brokenice/laravel-mysql-partition. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download brokenice/laravel-mysql-partition
More information about brokenice/laravel-mysql-partition
Files in brokenice/laravel-mysql-partition
Package laravel-mysql-partition
Short Description MySQL Partition extension for Laravel.
License MIT
Informations about the package laravel-mysql-partition
Laravel MySQL Partition
Laravel-mysql-partition is a useful Laravel package to easily work with MySQL Partition. please check the documentation for your MySQL version. Partitioning require a MySQL's version >= 5.1.0
★★ Star our github repository to help us!, or ☕ pay me a coffee ★★
Created by Luca Becchetti
Installation
Add the package using composer:
For Laravel versions before 5.5 or if not using auto-discovery, register the service provider in config/app.php
:
Quickstart
Create a migration
From the command line:
Then edit the migration you just created by adding one of the partition schema provided by this package;
Run the migration:
Partitions support
Package supports these methods of partitions:
Mysql Partition Types Supports:
- RANGE
- LIST
- HASH
- KEY
Special Partition Types Supports:
- YEARS
- YEARS AND MONTH
- MONTH (cooming soon)
- DAYS (cooming soon)
Partition by RANGE
This type of partitioning assigns rows to partitions based on column values falling within a given range.
Note: Using the above code you will not be able to insert records that do not correspond to any range, for example: 2010, to do this you must specify the creation of a partition for future values, you can do so by specifying the parameter includeFuturePartition to true, as per example:
Partition by LIST
Similar to partitioning by RANGE, except that the partition is selected based on columns matching one of a set of discrete values.
Partition by HASH
With this type of partitioning, a partition is selected based on the value returned by a user-defined expression that operates on column values in rows to be inserted into the table. The function may consist of any expression valid in MySQL that yields a nonnegative integer value. An extension to this type, LINEAR HASH, is also available.
Partition by KEY
This type of partitioning is similar to partitioning by HASH, except that only one or more columns to be evaluated are supplied, and the MySQL server provides its own hashing function. These columns can contain other than integer values, since the hashing function supplied by MySQL guarantees an integer result regardless of the column data type.
Partition by YEARS
This type of partitioning allow you to partition a table for a specified years range.
You can omit the end year of range, and current year will be used:
Partition by YEARS AND MONTHS
This type of partitioning allow you to partition a table for a specified years range, and sub partition each year for a month.
You can omit the end year of range, and current year will be used:
Composite primary key
To partition a table, columns must be an index, if you want to use a different column from id you have to change this line of you migration file:
to this, creating a composite primary key
Note: Using the above code you'll lose the autoincrement for id field, you can force it before run partition, if you need, with this code:
Querying parition with Eloquent
Using this package you can query an individual partition, or multiple partitions, directly from eloquent model:
Create a model
Then edit the model you just created:
Query to a single partition
Query to a multiple partition
Artisan command
This package comes with a useful set of artisan command:
Available commands
Action | Description |
---|---|
list |
Returns list of partition names for a specific table |
create |
Create partition on exisiting table |
delete |
Delete existing partition |
truncate |
Truncate existing partition |
optimize |
Optimize existing partition |
repair |
Repair existing partition |
check |
Check existing partition |
analyze |
Analyze existing partition |
rebuild |
Rebuild existing partition |
Form detail infomration on actions, refere to : this link.
List
Create
Delete
Truncate
Optimize
Repair
Check
Analyze
Rebuild
Tests
Comming soon
Integration tests will require a running MySQL database. If you have Docker installed, you can start easily start one:
Contributing
Recommendations and pull request are most welcome! Pull requests with tests are the best!.
Are you using this package?
I'm interested in making a list of all projects which use this library. Feel free to open an Issue on GitHub with the name and links of your project; we'll add it to this site.
Credits & License
larave-mysql-partition is owned and maintained by Luca Becchetti
As open source creation any help is welcome!
The code of this library is licensed under MIT License; you can use it in commercial products without any limitation.
The only requirement is to add a line in your Credits/About section with the text below:
About me
I am a professional programmer with a background in software design and development, currenlty i am a leader of "Brokenice" that provides high-performing, on-demand teams of developers for leading brands.
In the last years, I developed my qualitative skills on a startup company named "Frind" as Project Manager and ios senior software engineer, we had worked on a new social network application, it includes chat system based on XMPP Framework and Ejabberd server.
I'm high skilled in Software Design, i have been worked since i was young as webmaster, and i'm a senior Php developer. In the last years i have been worked hard with mobile application programming, Swift for ios world, and Java for Android world.
I'm an expert mobile developer and architect with several years of experience of team managing, design and development on all the major mobile platforms: iOS, Android (3+ years of experience).
I'm also has broad experience on Web design and development both on client and server side and API /Networking design.
All my last works are hosted on AWS Amazon cloud or Google Cloud Platform, i'm able to configure a network, with Unix servers. For my last works i configured apache2, ssl, ejabberd in cluster mode, Api servers with load balancer, and more.
When i was eleven, i created a CMS in ASP called openasp, it has been used for more years in more than 10.000 websites. The project has been closed when ASP has been deprecated, and i started to learn PHP.
I live in Assisi (Perugia), a small town in Italy, for any question, contact me
All versions of laravel-mysql-partition with dependencies
ext-pdo Version *
ext-json Version *
illuminate/database Version ^5.2|^6.0|^7.0|^8.0|^9.0|^10.0
ext-mbstring Version *