fast_schema_dumper 0.5.0 → 0.5.2
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/compose.yml +8 -0
- data/lib/fast_schema_dumper/fast_dumper.rb +4 -2
- data/lib/fast_schema_dumper/version.rb +1 -1
- metadata +2 -4
- data/.standard.yml +0 -5
- data/test/fast_schema_dumper_test.rb +0 -73
- 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: 318d9557a32b7d943e100a40a1a707842f0f1e7cc9465b95f5294c3e495dd5e3
|
|
4
|
+
data.tar.gz: 6fa2494751fe0027a52abeac9e7cdb66dcce881139c855a074eb0cf90e8f11c0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3fa88e9595021d89571795e8b9c0ce2cdb17f3fed68a3e357cb5572ec1e710f1b29f2c6235942d583a13f2946abb1998544edd18b0ec544587a7b7f3d4f12b7d
|
|
7
|
+
data.tar.gz: 935ab57a56740cd0f0fb75b650cae3f258e6e583da5a05e4af357eef6724530c1750b4205fa4e80b9a6bca416ff2e13f4f5738a183341d503d05fcb55a3164ad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.5.2] - 2026-04-15
|
|
4
|
+
|
|
5
|
+
- Fix generated column dump order to match ActiveRecord::SchemaDumper. [#32](https://github.com/smartbank-inc/fast_schema_dumper/pull/32)
|
|
6
|
+
- Fix generated column expression dump to align with Rails output. [#33](https://github.com/smartbank-inc/fast_schema_dumper/pull/33)
|
|
7
|
+
- Use include-based assertions in schema dumper tests. [#31](https://github.com/smartbank-inc/fast_schema_dumper/pull/31)
|
|
8
|
+
|
|
9
|
+
## [0.5.1] - 2026-04-13
|
|
10
|
+
|
|
11
|
+
- Add unit tests for pure private methods in `FastSchemaDumper::SchemaDumper`. [#27](https://github.com/smartbank-inc/fast_schema_dumper/pull/27)
|
|
12
|
+
- Trim unnecessary files from gem package. [#28](https://github.com/smartbank-inc/fast_schema_dumper/pull/28)
|
|
13
|
+
- Add MySQL integration tests for schema dump verification. [#29](https://github.com/smartbank-inc/fast_schema_dumper/pull/29)
|
|
14
|
+
|
|
3
15
|
## [0.5.0] - 2026-04-09
|
|
4
16
|
|
|
5
17
|
- Handle generated columns in fast dumper. [#23](https://github.com/smartbank-inc/fast_schema_dumper/pull/23)
|
data/compose.yml
ADDED
|
@@ -437,9 +437,11 @@ module FastSchemaDumper
|
|
|
437
437
|
end
|
|
438
438
|
|
|
439
439
|
def format_generated_column(column)
|
|
440
|
-
col_def = "t.virtual \"#{column['COLUMN_NAME']}\", type: :#{map_column_type(column)}
|
|
441
|
-
|
|
440
|
+
col_def = "t.virtual \"#{column['COLUMN_NAME']}\", type: :#{map_column_type(column)}"
|
|
441
|
+
expression = column['GENERATION_EXPRESSION'].gsub("\\'", "'")
|
|
442
442
|
col_def += ", comment: \"#{escape_string(column['COLUMN_COMMENT'])}\"" if column['COLUMN_COMMENT'] && !column['COLUMN_COMMENT'].empty?
|
|
443
|
+
col_def += ", as: \"#{escape_string(expression)}\""
|
|
444
|
+
col_def += ", stored: true" if stored_generated_column?(column)
|
|
443
445
|
col_def
|
|
444
446
|
end
|
|
445
447
|
|
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.5.
|
|
4
|
+
version: 0.5.2
|
|
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,73 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "test_helper"
|
|
4
|
-
require "fast_schema_dumper/fast_dumper"
|
|
5
|
-
|
|
6
|
-
class FastSchemaDumperTest < Minitest::Test
|
|
7
|
-
def test_that_it_has_a_version_number
|
|
8
|
-
refute_nil ::FastSchemaDumper::VERSION
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
def test_format_generated_column
|
|
12
|
-
dumper = FastSchemaDumper::SchemaDumper.new
|
|
13
|
-
column = {
|
|
14
|
-
'COLUMN_NAME' => 'active_unique_key',
|
|
15
|
-
'DATA_TYPE' => 'int',
|
|
16
|
-
'COLUMN_TYPE' => 'int',
|
|
17
|
-
'EXTRA' => 'STORED GENERATED',
|
|
18
|
-
'GENERATION_EXPRESSION' => 'if((`deleted_at` is null),1,NULL)',
|
|
19
|
-
'COLUMN_COMMENT' => '',
|
|
20
|
-
'IS_NULLABLE' => 'YES'
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
actual = dumper.send(:format_column, column)
|
|
24
|
-
|
|
25
|
-
assert_equal(
|
|
26
|
-
't.virtual "active_unique_key", type: :integer, as: "if((`deleted_at` is null),1,NULL)", stored: true',
|
|
27
|
-
actual
|
|
28
|
-
)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def test_format_generated_column_with_comment
|
|
32
|
-
dumper = FastSchemaDumper::SchemaDumper.new
|
|
33
|
-
column = {
|
|
34
|
-
'COLUMN_NAME' => 'full_name',
|
|
35
|
-
'DATA_TYPE' => 'varchar',
|
|
36
|
-
'COLUMN_TYPE' => 'varchar(255)',
|
|
37
|
-
'EXTRA' => 'VIRTUAL GENERATED',
|
|
38
|
-
'GENERATION_EXPRESSION' => 'concat(`first_name`,`last_name`)',
|
|
39
|
-
'COLUMN_COMMENT' => 'generated name',
|
|
40
|
-
'IS_NULLABLE' => 'YES'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
actual = dumper.send(:format_column, column)
|
|
44
|
-
|
|
45
|
-
assert_equal(
|
|
46
|
-
't.virtual "full_name", type: :string, as: "concat(`first_name`,`last_name`)", comment: "generated name"',
|
|
47
|
-
actual
|
|
48
|
-
)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def test_generated_column_detection_does_not_match_default_generated
|
|
52
|
-
dumper = FastSchemaDumper::SchemaDumper.new
|
|
53
|
-
column = {
|
|
54
|
-
'COLUMN_NAME' => 'created_at',
|
|
55
|
-
'DATA_TYPE' => 'datetime',
|
|
56
|
-
'COLUMN_TYPE' => 'datetime',
|
|
57
|
-
'EXTRA' => 'DEFAULT_GENERATED',
|
|
58
|
-
'COLUMN_DEFAULT' => 'CURRENT_TIMESTAMP',
|
|
59
|
-
'COLUMN_COMMENT' => '',
|
|
60
|
-
'IS_NULLABLE' => 'NO',
|
|
61
|
-
'COLUMN_KEY' => '',
|
|
62
|
-
'CHARACTER_MAXIMUM_LENGTH' => nil,
|
|
63
|
-
'NUMERIC_PRECISION' => nil,
|
|
64
|
-
'NUMERIC_SCALE' => nil,
|
|
65
|
-
'DATETIME_PRECISION' => nil,
|
|
66
|
-
'COLLATION_NAME' => nil
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
actual = dumper.send(:format_column, column)
|
|
70
|
-
|
|
71
|
-
assert_equal('t.datetime "created_at", default: -> { "CURRENT_TIMESTAMP" }, null: false', actual)
|
|
72
|
-
end
|
|
73
|
-
end
|