README.md in simple_mysql_partitioning-0.1.2 vs README.md in simple_mysql_partitioning-0.2.0
- old
+ new
@@ -7,11 +7,11 @@
## Installation
Add this line to your application's Gemfile:
```ruby
-gem 'simple_mysql_partitioning'
+gem 'simple_mysql_partitioning', '~> 0.2.0'
```
And then execute:
$ bundle
@@ -20,10 +20,39 @@
$ gem install simple_mysql_partitioning
## Usage
-TODO: Write usage instructions here
+``` ruby
+class DailyReport < ActiveRecord::Base
+ include SimpleMySQLPartitioning
+
+ # arg1: column
+ # type: partitiong type
+ partitioning_by :day, type: :range
+end
+
+
+# partition name, less than value
+pairs_name_with_values = [
+ ['p201808', '2018-09-01']
+]
+
+# add partition
+DailyReport.partition.add(pairs_name_with_values)
+
+# reorganize partition
+# If you want to reorganize partition, use this method and set reorganize partition name to second arg.
+DailyReport.partition.reorganize(pairs_name_with_values, 'p999999')
+
+# drop
+DailyReport.partition.drop('p201808')
+
+# exists?
+DailyReport.partition.exists?('p201808')
+```
+
+We support only range partitioning.
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.