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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9b478b3a2993c1fe6997b20825e9f4e3210c9d92398eafb4f52791397ff1585
4
- data.tar.gz: 5761bd4d938ee94ad5050820a9e03431a491c0b548b50d4125fd604ace2d3baf
3
+ metadata.gz: 6a03268e6929c7112bcb46f47c8391d1f488f996aaf6fbd6aa240d5dba3aaa4d
4
+ data.tar.gz: 367f8710027df425835f56f1df0daad9092df75173b35bb93c7415fc5a844447
5
5
  SHA512:
6
- metadata.gz: df2cad69755111f9b3576b000220a28e02db49b62bd7f5211d53aa39be8d03bfa63f6e86fe15ac2051bf3307dab41da72a56b68baad1b482ba3abb8d29fe2777
7
- data.tar.gz: 9717903a94fca3dc7ab94c3ea26ae347c6d98dadd6633f46726c78cb638e2d053cf7af85b79f3ff70978579d47fd43dae49e7b304c111f14057b5c2377aacb9a
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
  [![Test](https://github.com/smartbank-inc/fast_schema_dumper/actions/workflows/test.yml/badge.svg)](https://github.com/smartbank-inc/fast_schema_dumper/actions/workflows/test.yml)
2
+ [![Gem Version](https://badge.fury.io/rb/fast_schema_dumper.svg)](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. Currently only MySQL is supported.
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
- Requiring `fast_schema_dumper/ridgepole` will overwrite `Ridgepole::Dumper.dump`, which will force Ridgepole to use fast_schema_dumper.
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 ... --apply
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
@@ -0,0 +1,8 @@
1
+ services:
2
+ mysql:
3
+ image: mysql:8.0
4
+ environment:
5
+ MYSQL_ROOT_PASSWORD: password
6
+ MYSQL_DATABASE: fast_schema_dumper_test
7
+ ports:
8
+ - "3306:3306"
@@ -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(argv)
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)'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'fast_dumper'
2
4
 
3
5
  # Loading this file will overwrite `Ridgepole::Dumper.dump`.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FastSchemaDumper
4
- VERSION = "0.4.3"
4
+ VERSION = "0.5.1"
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "fast_schema_dumper/version"
2
4
 
3
5
  module FastSchemaDumper
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.3
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
@@ -1,5 +0,0 @@
1
- ruby_version: 3.2
2
- ignore:
3
- - "**/*":
4
- - Style/StringLiterals
5
- - Style/StringLiteralsInInterpolation
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "test_helper"
4
-
5
- class FastSchemaDumperTest < Minitest::Test
6
- def test_that_it_has_a_version_number
7
- refute_nil ::FastSchemaDumper::VERSION
8
- end
9
- end
data/test/test_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
- require "fast_schema_dumper"
5
-
6
- require "minitest/autorun"