PHPackages                             jinraynor1/partition\_rotator - 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. jinraynor1/partition\_rotator

ActiveLibrary

jinraynor1/partition\_rotator
=============================

Table Rotator

0.0.3(3y ago)038proprietaryPHPPHP &gt;=5.3.0

Since Feb 2Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jinraynor1/partition_rotator)[ Packagist](https://packagist.org/packages/jinraynor1/partition_rotator)[ RSS](/packages/jinraynor1-partition-rotator/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (2)Versions (4)Used By (0)

partition\_rotator
==================

[](#partition_rotator)

rotate table partition for MySQL

Getting Started
---------------

[](#getting-started)

### Hourly rotate mode

[](#hourly-rotate-mode)

First you must create the table

```
CREATE TABLE `test_rotate_hourly` (
  `dt` datetime NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
 PARTITION BY RANGE (TO_SECONDS(dt))
(PARTITION `start` VALUES LESS THAN (0) ,
PARTITION from2020100322 VALUES LESS THAN (TO_SECONDS('2020-10-03 23:00:00')) ,
PARTITION from2020100323 VALUES LESS THAN (TO_SECONDS('2020-10-04 00:00:00')) ,
PARTITION from2020100400 VALUES LESS THAN (TO_SECONDS('2020-10-04 01:00:00')) ,
PARTITION from2020100401 VALUES LESS THAN (TO_SECONDS('2020-10-04 02:00:00')) ,
PARTITION from2020100402 VALUES LESS THAN (TO_SECONDS('2020-10-04 03:00:00')) ,
PARTITION from2020100403 VALUES LESS THAN (TO_SECONDS('2020-10-04 04:00:00')) ,
PARTITION future VALUES LESS THAN MAXVALUE )
```

Then you can start rotating the table

```
