Socket
Book a DemoInstallSign in
Socket

mysql_partition

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mysql_partition

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

MysqlPartition

Ruby port of Perl's MySQL::Partition

Usage

require 'mysql_partition'

# List Partition
partition = MysqlPartition::SqlMaker.new(type: :list, table: "test", expression: "event_id")

partition.create_partitions("p1" => 1)
    #=> ALTER TABLE test PARTITION BY LIST (event_id) (PARTITION p1 VALUES IN (1))

partition.add_partitions("p2" => "2, 3")
    #=> ALTER TABLE test ADD PARTITION (PARTITION p2 VALUES IN (2, 3))

partition.drop_partitions("p1")
    #=> ALTER TABLE test DROP PARTITION p1

# Range Partition
partition = MysqlPartition::SqlMaker.new(type: :range, table: "test2", expression: "created_at")

partition.create_partitions('p20100101' => '2010-01-01')
    #=> ALTER TABLE test2 PARTITION BY RANGE (created_at) (PARTITION p20100101 VALUES LESS THAN ('2010-01-01'))

partition.add_partitions(
  'p20110101' => '2011-01-01',
  'p20120101' => '2012-01-01',
)
#=> ALTER TABLE test2 ADD PARTITION (PARTITION p20110101 VALUES LESS THAN ('2011-01-01'), PARTITION p20120101 VALUES LESS THAN ('2012-01-01'))

partition.drop_partitions('p20100101')
    #=> ALTER TABLE test2 DROP PARTITION p20100101

Installation

Add this line to your application's Gemfile:

gem 'mysql_partition'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mysql_partition

Contributing

  • Fork it ( https://github.com/hisaichi5518/mysql_partition/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 12 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.