simple_mysql_partitioning 0.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +31 -0
- data/.github/workflows/ci.yml +81 -0
- data/.gitignore +4 -0
- data/CHANGELOG.md +144 -0
- data/CLAUDE.md +68 -0
- data/README.md +29 -5
- data/docker/app/Dockerfile +1 -1
- data/docker-compose.yml +3 -2
- data/gemfiles/Gemfile.rails-4.2.1 +3 -0
- data/gemfiles/Gemfile.rails-5.0 +3 -0
- data/gemfiles/Gemfile.rails-6.0 +3 -0
- data/gemfiles/Gemfile.rails-6.1 +3 -0
- data/gemfiles/Gemfile.rails-7.0 +3 -0
- data/gemfiles/Gemfile.rails-7.1 +3 -0
- data/gemfiles/Gemfile.rails-7.2 +3 -0
- data/lib/simple_mysql_partitioning/adapter.rb +3 -0
- data/lib/simple_mysql_partitioning/base_partitioning.rb +2 -1
- data/lib/simple_mysql_partitioning/sql.rb +1 -1
- data/lib/simple_mysql_partitioning/version.rb +2 -2
- data/simple_mysql_partitioning.gemspec +11 -6
- metadata +61 -25
- data/.circleci/config.yml +0 -15
- data/.travis.yml +0 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8481c3a639ebb5fdb2d8f0ac7bf05e3091ae9808cbea9384d3c97967899409e9
|
|
4
|
+
data.tar.gz: 708518919a836f3f8ed590427e26195c74d63eb18a8677a7c0e681eb70694311
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 93f555c8fb6ba96885376879871a3d8bb534a76d07281b7017d4bbd0ab19744fdee11a558c6100d8ead6e4cb4dd3fa998a76303f6e8a7345399ba04da3c00658
|
|
7
|
+
data.tar.gz: a43c06c788f698c2ac4955ca886a11a64200c013295a39fb9e179f21adf9956a8209ebd625b42e4918468d03b6f0754f1a4d4edea0da75ca796b78827270098a
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
version: 2
|
|
2
|
+
updates:
|
|
3
|
+
# Maintain dependencies for GitHub Actions
|
|
4
|
+
- package-ecosystem: "github-actions"
|
|
5
|
+
directory: "/"
|
|
6
|
+
schedule:
|
|
7
|
+
interval: "weekly"
|
|
8
|
+
labels:
|
|
9
|
+
- "dependencies"
|
|
10
|
+
- "github-actions"
|
|
11
|
+
|
|
12
|
+
# Maintain dependencies for Bundler
|
|
13
|
+
- package-ecosystem: "bundler"
|
|
14
|
+
directory: "/"
|
|
15
|
+
schedule:
|
|
16
|
+
interval: "weekly"
|
|
17
|
+
labels:
|
|
18
|
+
- "dependencies"
|
|
19
|
+
- "bundler"
|
|
20
|
+
groups:
|
|
21
|
+
# Group Rails updates together
|
|
22
|
+
rails:
|
|
23
|
+
patterns:
|
|
24
|
+
- "rails"
|
|
25
|
+
- "activerecord"
|
|
26
|
+
- "activesupport"
|
|
27
|
+
# Group development dependencies together
|
|
28
|
+
development:
|
|
29
|
+
patterns:
|
|
30
|
+
- "rspec*"
|
|
31
|
+
- "rake"
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ '**' ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
ruby: ['3.0', '3.1', '3.2', '3.3']
|
|
17
|
+
rails: ['6.1', '7.0', '7.1', '7.2']
|
|
18
|
+
exclude:
|
|
19
|
+
# Rails 7.2 requires Ruby 3.1+
|
|
20
|
+
- ruby: '3.0'
|
|
21
|
+
rails: '7.2'
|
|
22
|
+
|
|
23
|
+
services:
|
|
24
|
+
mysql:
|
|
25
|
+
image: mysql:8.0
|
|
26
|
+
env:
|
|
27
|
+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
|
|
28
|
+
ports:
|
|
29
|
+
- 3306:3306
|
|
30
|
+
options: >-
|
|
31
|
+
--health-cmd="mysqladmin ping"
|
|
32
|
+
--health-interval=10s
|
|
33
|
+
--health-timeout=5s
|
|
34
|
+
--health-retries=3
|
|
35
|
+
|
|
36
|
+
env:
|
|
37
|
+
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/Gemfile.rails-${{ matrix.rails }}
|
|
38
|
+
MYSQL_DB_HOST: 127.0.0.1
|
|
39
|
+
|
|
40
|
+
steps:
|
|
41
|
+
- uses: actions/checkout@v4
|
|
42
|
+
|
|
43
|
+
- name: Set up Ruby
|
|
44
|
+
uses: ruby/setup-ruby@v1
|
|
45
|
+
with:
|
|
46
|
+
ruby-version: ${{ matrix.ruby }}
|
|
47
|
+
bundler-cache: false
|
|
48
|
+
|
|
49
|
+
- name: Install dependencies
|
|
50
|
+
run: |
|
|
51
|
+
sudo apt-get update
|
|
52
|
+
sudo apt-get install -y libmysqlclient-dev
|
|
53
|
+
|
|
54
|
+
- name: Debug environment
|
|
55
|
+
run: |
|
|
56
|
+
echo "BUNDLE_GEMFILE=$BUNDLE_GEMFILE"
|
|
57
|
+
echo "Ruby version: $(ruby -v)"
|
|
58
|
+
echo "Bundler version: $(bundle -v)"
|
|
59
|
+
ls -la gemfiles/
|
|
60
|
+
cat "$BUNDLE_GEMFILE"
|
|
61
|
+
|
|
62
|
+
- name: Bundle install
|
|
63
|
+
run: bundle install --jobs 4 --retry 3
|
|
64
|
+
|
|
65
|
+
- name: Wait for MySQL
|
|
66
|
+
run: |
|
|
67
|
+
until mysqladmin ping -h 127.0.0.1 --silent; do
|
|
68
|
+
echo 'waiting for mysql...'
|
|
69
|
+
sleep 1
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
- name: Run tests
|
|
73
|
+
run: bundle exec rspec
|
|
74
|
+
|
|
75
|
+
- name: Upload coverage
|
|
76
|
+
if: always()
|
|
77
|
+
uses: actions/upload-artifact@v4
|
|
78
|
+
with:
|
|
79
|
+
name: coverage-${{ matrix.ruby }}-rails-${{ matrix.rails }}
|
|
80
|
+
path: coverage/
|
|
81
|
+
if-no-files-found: ignore
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [2.0.0] - 2026-01-21
|
|
9
|
+
|
|
10
|
+
### ⚠️ BREAKING CHANGES
|
|
11
|
+
|
|
12
|
+
This is a major version upgrade that drops support for end-of-life (EOL) versions of Ruby, Rails, and MySQL. All users must upgrade their environments to supported versions.
|
|
13
|
+
|
|
14
|
+
#### Minimum Version Requirements
|
|
15
|
+
|
|
16
|
+
- **Ruby**: 2.3.7+ → **3.0.0+** (Ruby 2.x is no longer supported)
|
|
17
|
+
- **Rails/ActiveRecord**: 4.2.1+ → **6.1.0+** (Rails 4.x, 5.x, 6.0.x are no longer supported)
|
|
18
|
+
- **MySQL**: 5.7 → **8.0+** (MySQL 5.7 reached EOL in October 2023)
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- Support for Ruby 3.0, 3.1, 3.2, and 3.3
|
|
23
|
+
- Support for Rails 6.1, 7.0, 7.1, and 7.2
|
|
24
|
+
- GitHub Actions CI/CD pipeline with matrix testing
|
|
25
|
+
- Gemfiles for Rails 6.1, 7.0, 7.1, and 7.2
|
|
26
|
+
- Comprehensive documentation in CLAUDE.md
|
|
27
|
+
- Updated Docker development environment (Ruby 3.3, MySQL 8.0)
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Minimum Ruby version raised from 2.3.7 to 3.0.0
|
|
32
|
+
- Minimum ActiveRecord version raised from 4.2.1 to 6.1.0
|
|
33
|
+
- MySQL requirement updated from 5.7 to 8.0
|
|
34
|
+
- Updated development dependencies:
|
|
35
|
+
- `rake`: `>= 10.0` → `~> 13.0`
|
|
36
|
+
- `rspec`: `>= 3.0` → `~> 3.13`
|
|
37
|
+
- `mysql2`: `>= 0.5.0` → `~> 0.5.6`
|
|
38
|
+
- Migrated CI from Travis CI to GitHub Actions
|
|
39
|
+
- Updated README with new compatibility information
|
|
40
|
+
|
|
41
|
+
### Removed
|
|
42
|
+
|
|
43
|
+
- Support for Ruby 2.x (EOL)
|
|
44
|
+
- Support for Rails 4.x, 5.x, and 6.0.x (EOL)
|
|
45
|
+
- Support for MySQL 5.7 (EOL)
|
|
46
|
+
- `activerecord-compatible_legacy_migration` dependency (no longer needed)
|
|
47
|
+
- Travis CI configuration
|
|
48
|
+
|
|
49
|
+
### Migration Guide
|
|
50
|
+
|
|
51
|
+
#### For Ruby 2.x Users
|
|
52
|
+
|
|
53
|
+
Ruby 2.x reached end-of-life and is no longer supported. You must upgrade to Ruby 3.0 or higher:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Using rbenv
|
|
57
|
+
rbenv install 3.3.0
|
|
58
|
+
rbenv global 3.3.0
|
|
59
|
+
|
|
60
|
+
# Using rvm
|
|
61
|
+
rvm install 3.3.0
|
|
62
|
+
rvm use 3.3.0 --default
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Important Ruby 3.x Changes:**
|
|
66
|
+
- Keyword arguments are now separated from positional arguments
|
|
67
|
+
- Some methods deprecated in Ruby 2.x have been removed
|
|
68
|
+
- Hash implicit conversions are stricter
|
|
69
|
+
|
|
70
|
+
#### For Rails 4.x/5.x/6.0.x Users
|
|
71
|
+
|
|
72
|
+
Upgrade to Rails 6.1 or higher. Follow the official Rails upgrade guides:
|
|
73
|
+
- [Upgrading to Rails 6.1](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-0-to-rails-6-1)
|
|
74
|
+
- [Upgrading to Rails 7.0](https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#upgrading-from-rails-6-1-to-rails-7-0)
|
|
75
|
+
|
|
76
|
+
#### For MySQL 5.7 Users
|
|
77
|
+
|
|
78
|
+
MySQL 5.7 reached EOL in October 2023. Upgrade to MySQL 8.0:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Docker users
|
|
82
|
+
docker pull mysql:8.0
|
|
83
|
+
|
|
84
|
+
# Direct installation varies by platform
|
|
85
|
+
# See: https://dev.mysql.com/doc/refman/8.0/en/upgrading.html
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**MySQL 8.0 Changes:**
|
|
89
|
+
- Default authentication plugin changed to `caching_sha2_password`
|
|
90
|
+
- Some reserved words added
|
|
91
|
+
- Improved partitioning performance
|
|
92
|
+
|
|
93
|
+
#### Gemfile Updates
|
|
94
|
+
|
|
95
|
+
Update your Gemfile:
|
|
96
|
+
|
|
97
|
+
```ruby
|
|
98
|
+
# Before
|
|
99
|
+
gem 'simple_mysql_partitioning', '~> 1.0'
|
|
100
|
+
|
|
101
|
+
# After
|
|
102
|
+
gem 'simple_mysql_partitioning', '~> 2.0'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Then run:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
bundle update simple_mysql_partitioning
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Testing Your Application
|
|
112
|
+
|
|
113
|
+
After upgrading, thoroughly test your application:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Run your test suite
|
|
117
|
+
bundle exec rspec
|
|
118
|
+
|
|
119
|
+
# Test partition operations
|
|
120
|
+
rails console
|
|
121
|
+
> YourModel.partition.exists?('partition_name')
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Support
|
|
125
|
+
|
|
126
|
+
If you encounter issues during migration:
|
|
127
|
+
1. Check the [GitHub Issues](https://github.com/Andryu/simple_mysql_partitioning/issues)
|
|
128
|
+
2. Review the updated [README](README.md)
|
|
129
|
+
3. Consult [CLAUDE.md](CLAUDE.md) for development guidance
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## [1.0.0] - Previous Releases
|
|
134
|
+
|
|
135
|
+
### Features
|
|
136
|
+
- RANGE COLUMNS partitioning support
|
|
137
|
+
- Partition creation, addition, reorganization, and deletion
|
|
138
|
+
- ActiveRecord integration
|
|
139
|
+
- Support for Ruby 2.3.7+
|
|
140
|
+
- Support for Rails 4.2.1+
|
|
141
|
+
- Support for MySQL 5.7+
|
|
142
|
+
|
|
143
|
+
[2.0.0]: https://github.com/Andryu/simple_mysql_partitioning/compare/v1.0.0...v2.0.0
|
|
144
|
+
[1.0.0]: https://github.com/Andryu/simple_mysql_partitioning/releases/tag/v1.0.0
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
このファイルは、このリポジトリでコードを扱う際のClaude Code (claude.ai/code)向けのガイダンスを提供します。
|
|
4
|
+
|
|
5
|
+
## コマンド
|
|
6
|
+
|
|
7
|
+
### テスト
|
|
8
|
+
- テスト実行: `bundle exec rake spec` または `bundle exec rspec`
|
|
9
|
+
- 特定のRailsバージョンでのテスト実行: `BUNDLE_GEMFILE=gemfiles/Gemfile.rails-7.0 bundle exec rspec`
|
|
10
|
+
- 利用可能なRailsバージョン: 6.1, 7.0, 7.1, 7.2 (gemfilesディレクトリを参照)
|
|
11
|
+
- レガシーサポート: Rails 4.2.1, 5.0, 6.0用のGemfileも存在しますが、非推奨です
|
|
12
|
+
|
|
13
|
+
### 開発
|
|
14
|
+
- 依存関係のインストール: `bundle install`
|
|
15
|
+
- 対話式コンソール: `bin/console`
|
|
16
|
+
- 開発環境のセットアップ: `bin/setup`
|
|
17
|
+
|
|
18
|
+
### Docker開発
|
|
19
|
+
- MySQLとアプリコンテナの起動: `docker-compose up`
|
|
20
|
+
- MySQLはポート3307 (ホスト) / 3306 (コンテナ)で利用可能
|
|
21
|
+
|
|
22
|
+
## アーキテクチャ
|
|
23
|
+
|
|
24
|
+
### コア構造
|
|
25
|
+
これはActiveRecordモデルにMySQLテーブルパーティショニング機能を提供するRuby gemです。このgemはモジュラー設計に従っています:
|
|
26
|
+
|
|
27
|
+
- **SimpleMySQLPartitioning module**: ActiveRecordモデルにインクルードされるメインエントリーポイント
|
|
28
|
+
- **Adapter module**: モデルにクラスメソッド(`partitioning_by`、`partition`、`partition_config`)を提供
|
|
29
|
+
- **BasePartitioning class**: 共通のパーティション操作(`exists?`、`drop`)を持つ抽象基底クラス
|
|
30
|
+
- **Range class**: COLUMNSサポート付きRANGEパーティショニングの具象実装
|
|
31
|
+
- **SQL class**: すべてのパーティション操作用の静的SQLクエリジェネレータ
|
|
32
|
+
|
|
33
|
+
### 主要コンポーネント
|
|
34
|
+
|
|
35
|
+
#### モジュールインクルージョンパターン
|
|
36
|
+
`SimpleMySQLPartitioning`がモデルにインクルードされると、自動的に`Adapter`モジュールがインクルードされ、モデルクラスにパーティショニングクラスメソッドが拡張されます。
|
|
37
|
+
|
|
38
|
+
#### パーティション設定
|
|
39
|
+
モデルは以下でパーティショニングを定義します: `partitioning_by :column_name, type: :range`
|
|
40
|
+
これにより`ModelClass.partition`経由でアクセス可能なパーティションインスタンスが作成されます。
|
|
41
|
+
|
|
42
|
+
#### SQL生成
|
|
43
|
+
`SQL`クラスはMySQL固有のALTER TABLE文を生成します:
|
|
44
|
+
- RANGE COLUMNSでのパーティション作成
|
|
45
|
+
- 新しいパーティションの追加
|
|
46
|
+
- 既存パーティションの再編成
|
|
47
|
+
- パーティションの削除
|
|
48
|
+
- パーティション存在確認
|
|
49
|
+
|
|
50
|
+
#### レンジパーティショニング
|
|
51
|
+
現在はCOLUMNS構文を使用したRANGEパーティショニングのみをサポートしています。操作には以下が含まれます:
|
|
52
|
+
- `create(pairs)`: 初期パーティション作成
|
|
53
|
+
- `add(pairs)`: 新しいパーティションの追加
|
|
54
|
+
- `reorganize(pairs, name, value)`: MAXVALUEサポート付きパーティション再編成
|
|
55
|
+
- `exists?(name)`: パーティションの存在確認
|
|
56
|
+
- `drop(name)`: パーティションの削除
|
|
57
|
+
|
|
58
|
+
### データベース要件
|
|
59
|
+
- MySQL 8.0+が必要 (docker-compose.ymlで指定)
|
|
60
|
+
- データベース接続にmysql2 gemを使用
|
|
61
|
+
- ActiveRecord接続処理と統合
|
|
62
|
+
- 最小Ruby要件: 3.0.0+
|
|
63
|
+
- 最小ActiveRecord要件: 6.1.0+
|
|
64
|
+
|
|
65
|
+
### テストインフラストラクチャ
|
|
66
|
+
- データベースセットアップ・ティアダウン付きRSpecテストスイート
|
|
67
|
+
- マルチバージョンRails互換性テスト
|
|
68
|
+
- データベース設定はspec/support/ファイルで処理
|
data/README.md
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
# SimpleMysqlPartitioning
|
|
2
2
|
|
|
3
|
-
[](https://github.com/Andryu/simple_mysql_partitioning/actions/workflows/ci.yml)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A Ruby gem that provides simple MySQL table partitioning functionality for ActiveRecord models. This gem allows you to easily manage RANGE partitions in MySQL databases through an intuitive Ruby API.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Ruby 3.0 or higher
|
|
10
|
+
- Rails/ActiveRecord 6.1 or higher
|
|
11
|
+
- MySQL 8.0 or higher
|
|
12
|
+
|
|
13
|
+
## Compatibility
|
|
14
|
+
|
|
15
|
+
This gem is tested against:
|
|
16
|
+
|
|
17
|
+
- Ruby: 3.0, 3.1, 3.2, 3.3
|
|
18
|
+
- Rails: 6.1, 7.0, 7.1, 7.2
|
|
19
|
+
- MySQL: 8.0
|
|
8
20
|
|
|
9
21
|
## Installation
|
|
10
22
|
|
|
11
23
|
Add this line to your application's Gemfile:
|
|
12
24
|
|
|
13
25
|
```ruby
|
|
14
|
-
gem 'simple_mysql_partitioning', '~>
|
|
26
|
+
gem 'simple_mysql_partitioning', '~> 2.0'
|
|
15
27
|
```
|
|
16
28
|
|
|
17
29
|
And then execute:
|
|
@@ -39,6 +51,11 @@ pairs_name_with_values = [
|
|
|
39
51
|
['p201808', '2018-09-01']
|
|
40
52
|
]
|
|
41
53
|
|
|
54
|
+
# create partition
|
|
55
|
+
DailyReport.partition.create(pairs_name_with_values)
|
|
56
|
+
|
|
57
|
+
NOTE: No support MAXVALUE, please use add method after created partition.
|
|
58
|
+
|
|
42
59
|
# add partition
|
|
43
60
|
DailyReport.partition.add(pairs_name_with_values)
|
|
44
61
|
|
|
@@ -62,6 +79,13 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
|
62
79
|
|
|
63
80
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
64
81
|
|
|
82
|
+
### How to test for local
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
BUNDLE_GEMFILE=gemfiles/Gemfile.rails-** bundle exec rspec
|
|
86
|
+
ex) BUNDLE_GEMFILE=gemfiles/Gemfile.rails-7.0 bundle exec rspec
|
|
87
|
+
```
|
|
88
|
+
|
|
65
89
|
## Contributing
|
|
66
90
|
|
|
67
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
91
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Andryu/simple_mysql_partitioning.
|
data/docker/app/Dockerfile
CHANGED
data/docker-compose.yml
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
version: '3'
|
|
2
2
|
services:
|
|
3
3
|
mysql:
|
|
4
|
-
image: mysql:
|
|
4
|
+
image: mysql:8.0
|
|
5
5
|
ports:
|
|
6
|
-
- "
|
|
6
|
+
- "3307:3306"
|
|
7
7
|
environment:
|
|
8
8
|
- MYSQL_ALLOW_EMPTY_PASSWORD=yes
|
|
9
9
|
app:
|
|
@@ -13,6 +13,7 @@ services:
|
|
|
13
13
|
build: docker/app
|
|
14
14
|
volumes:
|
|
15
15
|
- .:/app
|
|
16
|
+
- ~/.gem/credentials:/root/.gem/credentials
|
|
16
17
|
- bundle-vol:/bundle:cached
|
|
17
18
|
command: irb
|
|
18
19
|
tty: true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'active_record'
|
|
2
|
+
require 'active_support/core_ext/object/blank'
|
|
2
3
|
require 'simple_mysql_partitioning/sql'
|
|
3
4
|
|
|
4
5
|
module SimpleMySQLPartitioning
|
|
@@ -13,7 +14,7 @@ module SimpleMySQLPartitioning
|
|
|
13
14
|
def exists?(partition_name)
|
|
14
15
|
klass.connection.select_all(
|
|
15
16
|
SQL.exists_sql(table_name, partition_name)
|
|
16
|
-
).
|
|
17
|
+
).any?
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def drop(partition_name)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module
|
|
2
|
-
VERSION = '0.
|
|
1
|
+
module SimpleMySQLPartitioning
|
|
2
|
+
VERSION = '2.0.0'.freeze
|
|
3
3
|
end
|
|
@@ -4,13 +4,14 @@ require 'simple_mysql_partitioning/version'
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = 'simple_mysql_partitioning'
|
|
7
|
-
spec.version =
|
|
7
|
+
spec.version = SimpleMySQLPartitioning::VERSION
|
|
8
8
|
spec.authors = ['Shunsuke Andoh']
|
|
9
9
|
spec.email = ['shunsuke.andoh@gmail.com']
|
|
10
10
|
|
|
11
11
|
spec.summary = ' Generate partitioning sql for mysql'
|
|
12
12
|
spec.description = ' simple generate partition sql'
|
|
13
13
|
spec.homepage = 'https://github.com/Andryu/simple_mysql_partitioning'
|
|
14
|
+
spec.license = 'MIT'
|
|
14
15
|
|
|
15
16
|
# Specify which files should be added to the gem when it is released.
|
|
16
17
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
@@ -20,10 +21,14 @@ Gem::Specification.new do |spec|
|
|
|
20
21
|
spec.bindir = 'exe'
|
|
21
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
23
|
spec.require_paths = ['lib']
|
|
24
|
+
spec.required_ruby_version = '>= 3.0.0'
|
|
23
25
|
|
|
24
|
-
spec.add_dependency 'activerecord',
|
|
25
|
-
spec.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
spec.
|
|
26
|
+
spec.add_dependency 'activerecord', '>= 6.1.0', '< 8.0'
|
|
27
|
+
spec.add_dependency 'activesupport', '>= 6.1.0', '< 8.0'
|
|
28
|
+
# Pin concurrent-ruby to < 1.3.5 for Rails 6.1 compatibility
|
|
29
|
+
# concurrent-ruby 1.3.5+ removed logger dependency causing NameError with Rails 6.1
|
|
30
|
+
spec.add_dependency 'concurrent-ruby', '~> 1.3.0', '< 1.3.5'
|
|
31
|
+
spec.add_development_dependency 'mysql2', '~> 0.5.6'
|
|
32
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.13'
|
|
29
34
|
end
|
metadata
CHANGED
|
@@ -1,91 +1,117 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_mysql_partitioning
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shunsuke Andoh
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
-
- - "
|
|
19
|
+
version: 6.1.0
|
|
20
|
+
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version:
|
|
22
|
+
version: '8.0'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
26
26
|
requirements:
|
|
27
|
-
- - "
|
|
27
|
+
- - ">="
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version:
|
|
30
|
-
- - "
|
|
29
|
+
version: 6.1.0
|
|
30
|
+
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
32
|
+
version: '8.0'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
|
-
name:
|
|
34
|
+
name: activesupport
|
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: 6.1.0
|
|
40
|
+
- - "<"
|
|
41
|
+
- !ruby/object:Gem::Version
|
|
42
|
+
version: '8.0'
|
|
43
|
+
type: :runtime
|
|
44
|
+
prerelease: false
|
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
46
|
+
requirements:
|
|
47
|
+
- - ">="
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: 6.1.0
|
|
50
|
+
- - "<"
|
|
51
|
+
- !ruby/object:Gem::Version
|
|
52
|
+
version: '8.0'
|
|
53
|
+
- !ruby/object:Gem::Dependency
|
|
54
|
+
name: concurrent-ruby
|
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
|
36
56
|
requirements:
|
|
37
57
|
- - "~>"
|
|
38
58
|
- !ruby/object:Gem::Version
|
|
39
|
-
version:
|
|
40
|
-
|
|
59
|
+
version: 1.3.0
|
|
60
|
+
- - "<"
|
|
61
|
+
- !ruby/object:Gem::Version
|
|
62
|
+
version: 1.3.5
|
|
63
|
+
type: :runtime
|
|
41
64
|
prerelease: false
|
|
42
65
|
version_requirements: !ruby/object:Gem::Requirement
|
|
43
66
|
requirements:
|
|
44
67
|
- - "~>"
|
|
45
68
|
- !ruby/object:Gem::Version
|
|
46
|
-
version:
|
|
69
|
+
version: 1.3.0
|
|
70
|
+
- - "<"
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: 1.3.5
|
|
47
73
|
- !ruby/object:Gem::Dependency
|
|
48
74
|
name: mysql2
|
|
49
75
|
requirement: !ruby/object:Gem::Requirement
|
|
50
76
|
requirements:
|
|
51
77
|
- - "~>"
|
|
52
78
|
- !ruby/object:Gem::Version
|
|
53
|
-
version: 0.5.
|
|
79
|
+
version: 0.5.6
|
|
54
80
|
type: :development
|
|
55
81
|
prerelease: false
|
|
56
82
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
83
|
requirements:
|
|
58
84
|
- - "~>"
|
|
59
85
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: 0.5.
|
|
86
|
+
version: 0.5.6
|
|
61
87
|
- !ruby/object:Gem::Dependency
|
|
62
88
|
name: rake
|
|
63
89
|
requirement: !ruby/object:Gem::Requirement
|
|
64
90
|
requirements:
|
|
65
91
|
- - "~>"
|
|
66
92
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '
|
|
93
|
+
version: '13.0'
|
|
68
94
|
type: :development
|
|
69
95
|
prerelease: false
|
|
70
96
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
97
|
requirements:
|
|
72
98
|
- - "~>"
|
|
73
99
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '
|
|
100
|
+
version: '13.0'
|
|
75
101
|
- !ruby/object:Gem::Dependency
|
|
76
102
|
name: rspec
|
|
77
103
|
requirement: !ruby/object:Gem::Requirement
|
|
78
104
|
requirements:
|
|
79
105
|
- - "~>"
|
|
80
106
|
- !ruby/object:Gem::Version
|
|
81
|
-
version: '3.
|
|
107
|
+
version: '3.13'
|
|
82
108
|
type: :development
|
|
83
109
|
prerelease: false
|
|
84
110
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
111
|
requirements:
|
|
86
112
|
- - "~>"
|
|
87
113
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: '3.
|
|
114
|
+
version: '3.13'
|
|
89
115
|
description: " simple generate partition sql"
|
|
90
116
|
email:
|
|
91
117
|
- shunsuke.andoh@gmail.com
|
|
@@ -93,10 +119,12 @@ executables: []
|
|
|
93
119
|
extensions: []
|
|
94
120
|
extra_rdoc_files: []
|
|
95
121
|
files:
|
|
96
|
-
- ".
|
|
122
|
+
- ".github/dependabot.yml"
|
|
123
|
+
- ".github/workflows/ci.yml"
|
|
97
124
|
- ".gitignore"
|
|
98
125
|
- ".rspec"
|
|
99
|
-
-
|
|
126
|
+
- CHANGELOG.md
|
|
127
|
+
- CLAUDE.md
|
|
100
128
|
- Gemfile
|
|
101
129
|
- README.md
|
|
102
130
|
- Rakefile
|
|
@@ -104,6 +132,13 @@ files:
|
|
|
104
132
|
- bin/setup
|
|
105
133
|
- docker-compose.yml
|
|
106
134
|
- docker/app/Dockerfile
|
|
135
|
+
- gemfiles/Gemfile.rails-4.2.1
|
|
136
|
+
- gemfiles/Gemfile.rails-5.0
|
|
137
|
+
- gemfiles/Gemfile.rails-6.0
|
|
138
|
+
- gemfiles/Gemfile.rails-6.1
|
|
139
|
+
- gemfiles/Gemfile.rails-7.0
|
|
140
|
+
- gemfiles/Gemfile.rails-7.1
|
|
141
|
+
- gemfiles/Gemfile.rails-7.2
|
|
107
142
|
- lib/simple_mysql_partitioning.rb
|
|
108
143
|
- lib/simple_mysql_partitioning/adapter.rb
|
|
109
144
|
- lib/simple_mysql_partitioning/base_partitioning.rb
|
|
@@ -112,7 +147,8 @@ files:
|
|
|
112
147
|
- lib/simple_mysql_partitioning/version.rb
|
|
113
148
|
- simple_mysql_partitioning.gemspec
|
|
114
149
|
homepage: https://github.com/Andryu/simple_mysql_partitioning
|
|
115
|
-
licenses:
|
|
150
|
+
licenses:
|
|
151
|
+
- MIT
|
|
116
152
|
metadata: {}
|
|
117
153
|
post_install_message:
|
|
118
154
|
rdoc_options: []
|
|
@@ -122,14 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
122
158
|
requirements:
|
|
123
159
|
- - ">="
|
|
124
160
|
- !ruby/object:Gem::Version
|
|
125
|
-
version:
|
|
161
|
+
version: 3.0.0
|
|
126
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
163
|
requirements:
|
|
128
164
|
- - ">="
|
|
129
165
|
- !ruby/object:Gem::Version
|
|
130
166
|
version: '0'
|
|
131
167
|
requirements: []
|
|
132
|
-
rubygems_version: 3.0.3
|
|
168
|
+
rubygems_version: 3.0.3.1
|
|
133
169
|
signing_key:
|
|
134
170
|
specification_version: 4
|
|
135
171
|
summary: Generate partitioning sql for mysql
|
data/.circleci/config.yml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Use the latest 2.1 version of CircleCI pipeline processing engine, see https://circleci.com/docs/2.0/configuration-reference/
|
|
2
|
-
version: 2.1
|
|
3
|
-
|
|
4
|
-
# Use a package of configuration called an orb, see https://circleci.com/docs/2.0/orb-intro/
|
|
5
|
-
orbs:
|
|
6
|
-
# Declare a dependency on the welcome-orb
|
|
7
|
-
welcome: circleci/welcome-orb@0.3.1
|
|
8
|
-
|
|
9
|
-
# Orchestrate or schedule a set of jobs, see https://circleci.com/docs/2.0/workflows/
|
|
10
|
-
workflows:
|
|
11
|
-
# Name the workflow "Welcome"
|
|
12
|
-
Welcome:
|
|
13
|
-
# Run the welcome/run job in its own container
|
|
14
|
-
jobs:
|
|
15
|
-
- welcome/run
|