fast_schema_dumper 0.4.3 → 0.5.1
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/CHANGELOG.md +12 -0
- data/README.md +12 -4
- data/compose.yml +8 -0
- data/lib/fast_schema_dumper/cli.rb +3 -1
- data/lib/fast_schema_dumper/fast_dumper.rb +18 -0
- data/lib/fast_schema_dumper/ridgepole.rb +2 -0
- data/lib/fast_schema_dumper/version.rb +1 -1
- data/lib/fast_schema_dumper.rb +2 -0
- metadata +2 -4
- data/.standard.yml +0 -5
- data/test/fast_schema_dumper_test.rb +0 -9
- data/test/test_helper.rb +0 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6a03268e6929c7112bcb46f47c8391d1f488f996aaf6fbd6aa240d5dba3aaa4d
|
|
4
|
+
data.tar.gz: 367f8710027df425835f56f1df0daad9092df75173b35bb93c7415fc5a844447
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8e2ce6947ad22c3ac8c32327fda4c3c57bf1583d7e428d4cf57f76372637e7ce67f8b45d0bbbffcb44312e2fb25a612ecde0656131a06c01eaed68c24d2d498
|
|
7
|
+
data.tar.gz: 9c53c15564bda435c045fdacd0d85ed5f638fad82e1d43a3c772475f66c95ab574bb00a59a4714a0be8f0e9fcca5f8a956fd4e98fc0c792649e0517b86373ceb
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.5.1] - 2026-04-13
|
|
4
|
+
|
|
5
|
+
- Add unit tests for pure private methods in `FastSchemaDumper::SchemaDumper`. [#27](https://github.com/smartbank-inc/fast_schema_dumper/pull/27)
|
|
6
|
+
- Trim unnecessary files from gem package. [#28](https://github.com/smartbank-inc/fast_schema_dumper/pull/28)
|
|
7
|
+
- Add MySQL integration tests for schema dump verification. [#29](https://github.com/smartbank-inc/fast_schema_dumper/pull/29)
|
|
8
|
+
|
|
9
|
+
## [0.5.0] - 2026-04-09
|
|
10
|
+
|
|
11
|
+
- Handle generated columns in fast dumper. [#23](https://github.com/smartbank-inc/fast_schema_dumper/pull/23)
|
|
12
|
+
- Add frozen string literal pragmas and update README. [#25](https://github.com/smartbank-inc/fast_schema_dumper/pull/25)
|
|
13
|
+
- Add RubyGems version badge to README. [#17](https://github.com/smartbank-inc/fast_schema_dumper/pull/17)
|
|
14
|
+
|
|
3
15
|
## [0.4.3] - 2026-03-11
|
|
4
16
|
|
|
5
17
|
- Introduce StandardRB for code linting. [#9](https://github.com/smartbank-inc/fast_schema_dumper/pull/9)
|
data/README.md
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
[](https://github.com/smartbank-inc/fast_schema_dumper/actions/workflows/test.yml)
|
|
2
|
+
[](https://badge.fury.io/rb/fast_schema_dumper)
|
|
2
3
|
|
|
3
4
|
# fast_schema_dumper
|
|
4
5
|
|
|
5
|
-
A super fast alternative to ActiveRecord::SchemaDumper
|
|
6
|
+
A super fast alternative to `ActiveRecord::SchemaDumper`. Currently only MySQL is supported.
|
|
7
|
+
|
|
8
|
+
## What It Does
|
|
9
|
+
|
|
10
|
+
- Reads schema metadata directly from `INFORMATION_SCHEMA`
|
|
11
|
+
- Emits Rails-style `schema.rb` output
|
|
12
|
+
- Works as a standalone executable
|
|
13
|
+
- Can override `Ridgepole::Dumper.dump`
|
|
6
14
|
|
|
7
15
|
## Usage
|
|
8
16
|
|
|
9
17
|
### Ridgepole integration
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
Require `fast_schema_dumper/ridgepole` after loading `ridgepole` to replace `Ridgepole::Dumper.dump` with `fast_schema_dumper`.
|
|
12
20
|
|
|
13
|
-
```
|
|
14
|
-
RUBYOPT='-rridgepole -rfast_schema_dumper' ridgepole
|
|
21
|
+
```bash
|
|
22
|
+
RUBYOPT='-rridgepole -rfast_schema_dumper/ridgepole' ridgepole --apply
|
|
15
23
|
```
|
|
16
24
|
|
|
17
25
|
#### Environment variables for Ridgepole
|
data/compose.yml
ADDED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'erb'
|
|
2
4
|
require 'active_record'
|
|
3
5
|
require 'active_record/database_configurations'
|
|
@@ -10,7 +12,7 @@ module FastSchemaDumper
|
|
|
10
12
|
new.run(...)
|
|
11
13
|
end
|
|
12
14
|
|
|
13
|
-
def run(
|
|
15
|
+
def run(_argv)
|
|
14
16
|
env = ENV['RAILS_ENV'] || 'development'
|
|
15
17
|
|
|
16
18
|
database_yml_path = File.join(Dir.pwd, 'config', 'database.yml')
|
|
@@ -38,6 +38,7 @@ module FastSchemaDumper
|
|
|
38
38
|
, NUMERIC_SCALE
|
|
39
39
|
, COLUMN_TYPE
|
|
40
40
|
, EXTRA
|
|
41
|
+
, GENERATION_EXPRESSION
|
|
41
42
|
, COLUMN_COMMENT
|
|
42
43
|
, DATETIME_PRECISION
|
|
43
44
|
, COLLATION_NAME
|
|
@@ -364,6 +365,8 @@ module FastSchemaDumper
|
|
|
364
365
|
end
|
|
365
366
|
|
|
366
367
|
def format_column(column)
|
|
368
|
+
return format_generated_column(column) if generated_column?(column)
|
|
369
|
+
|
|
367
370
|
col_def = "t.#{map_column_type(column)} \"#{column['COLUMN_NAME']}\""
|
|
368
371
|
|
|
369
372
|
# limit (varchar, char)
|
|
@@ -433,6 +436,21 @@ module FastSchemaDumper
|
|
|
433
436
|
col_def
|
|
434
437
|
end
|
|
435
438
|
|
|
439
|
+
def format_generated_column(column)
|
|
440
|
+
col_def = "t.virtual \"#{column['COLUMN_NAME']}\", type: :#{map_column_type(column)}, as: \"#{escape_string(column['GENERATION_EXPRESSION'])}\""
|
|
441
|
+
col_def += ", stored: true" if stored_generated_column?(column)
|
|
442
|
+
col_def += ", comment: \"#{escape_string(column['COLUMN_COMMENT'])}\"" if column['COLUMN_COMMENT'] && !column['COLUMN_COMMENT'].empty?
|
|
443
|
+
col_def
|
|
444
|
+
end
|
|
445
|
+
|
|
446
|
+
def generated_column?(column)
|
|
447
|
+
column['EXTRA'].include?(' GENERATED')
|
|
448
|
+
end
|
|
449
|
+
|
|
450
|
+
def stored_generated_column?(column)
|
|
451
|
+
column['EXTRA'].include?('STORED GENERATED')
|
|
452
|
+
end
|
|
453
|
+
|
|
436
454
|
def map_column_type(column)
|
|
437
455
|
# Check for boolean (tinyint(1))
|
|
438
456
|
if column['COLUMN_TYPE'] == 'tinyint(1)'
|
data/lib/fast_schema_dumper.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fast_schema_dumper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daisuke Aritomo
|
|
@@ -46,18 +46,16 @@ executables:
|
|
|
46
46
|
extensions: []
|
|
47
47
|
extra_rdoc_files: []
|
|
48
48
|
files:
|
|
49
|
-
- ".standard.yml"
|
|
50
49
|
- CHANGELOG.md
|
|
51
50
|
- README.md
|
|
52
51
|
- Rakefile
|
|
52
|
+
- compose.yml
|
|
53
53
|
- exe/fast_schema_dumper
|
|
54
54
|
- lib/fast_schema_dumper.rb
|
|
55
55
|
- lib/fast_schema_dumper/cli.rb
|
|
56
56
|
- lib/fast_schema_dumper/fast_dumper.rb
|
|
57
57
|
- lib/fast_schema_dumper/ridgepole.rb
|
|
58
58
|
- lib/fast_schema_dumper/version.rb
|
|
59
|
-
- test/fast_schema_dumper_test.rb
|
|
60
|
-
- test/test_helper.rb
|
|
61
59
|
homepage: https://github.com/osyoyu/fast_schema_dumper
|
|
62
60
|
licenses: []
|
|
63
61
|
metadata:
|
data/.standard.yml
DELETED