ridgepole 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +4 -2
- data/bin/ridgepole +3 -5
- data/lib/ridgepole/cli/config.rb +7 -14
- data/lib/ridgepole/diff.rb +8 -6
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e28849a4ffd0e89057ec0aca0d8144a7c627f6947efe49a0c0ebcb3a5bf8d91
|
4
|
+
data.tar.gz: cff35f1be11654d25a0aa954d2d1af85ee8b7c5aa649ce2425227637ca340b10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 893204d453f9d96468e6a43e5843d5c1f8b2407f3b14bc4572836022ca240b4eaf3f8a39163ee2dcd753168640bce8b721fde35da5a713ce7941056c2e71a747
|
7
|
+
data.tar.gz: 33366d9df07035e062ad42a534292200076358c60242c17f14c05d6ba63c98443e35cf15ab21af097feb303e8257efc10f253c89c379daf0264a17a3b56d8bb8
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## 2.0
|
4
4
|
|
5
|
+
### 2.0.2 (2024/04/21)
|
6
|
+
|
7
|
+
- Add `--drop-table-only` option [pull#477](https://github.com/ridgepole/ridgepole/pull/477)
|
8
|
+
|
5
9
|
### 2.0.2 (2024/02/25)
|
6
10
|
|
7
11
|
- Fix bug that cannot include single quote in table comment [pull#467](https://github.com/ridgepole/ridgepole/pull/467)
|
data/README.md
CHANGED
@@ -82,13 +82,14 @@ Usage: ridgepole [options]
|
|
82
82
|
--dump-with-default-fk-name
|
83
83
|
--index-removed-drop-column
|
84
84
|
--drop-table
|
85
|
+
--drop-table-only
|
85
86
|
--mysql-change-table-options
|
86
87
|
--mysql-change-table-comment
|
87
88
|
--check-relation-type DEF_PK
|
88
89
|
--ignore-table-comment
|
89
90
|
--skip-column-comment-change
|
90
|
-
--create-table-with-index
|
91
91
|
--allow-pk-change
|
92
|
+
--create-table-with-index
|
92
93
|
--mysql-dump-auto-increment
|
93
94
|
-r, --require LIBS
|
94
95
|
--log-file LOG_FILE
|
@@ -338,7 +339,8 @@ bundle exec appraisal activerecord-7.0 rake
|
|
338
339
|
# MYSQL80=1 bundle exec appraisal activerecord-7.0 rake
|
339
340
|
```
|
340
341
|
|
341
|
-
|
342
|
+
> [!note]
|
343
|
+
> mysql-client/postgresql-client is required for testing.
|
342
344
|
|
343
345
|
## Demo
|
344
346
|
|
data/bin/ridgepole
CHANGED
@@ -86,8 +86,7 @@ ARGV.options do |opt|
|
|
86
86
|
opt.on('', '--dry-run') { options[:dry_run] = true }
|
87
87
|
opt.on('', '--table-options OPTIONS') { |v| options[:table_options] = v }
|
88
88
|
opt.on('', '--table-hash-options OPTIONS') do |v|
|
89
|
-
|
90
|
-
hash = YAML.safe_load(v).deep_symbolize_keys
|
89
|
+
hash = YAML.safe_load(v, symbolize_names: true)
|
91
90
|
|
92
91
|
case hash[:id]
|
93
92
|
when String
|
@@ -137,6 +136,7 @@ ARGV.options do |opt|
|
|
137
136
|
opt.on('', '--dump-with-default-fk-name') { options[:dump_with_default_fk_name] = true }
|
138
137
|
opt.on('', '--index-removed-drop-column') { options[:index_removed_drop_column] = true }
|
139
138
|
opt.on('', '--drop-table') { options[:force_drop_table] = true }
|
139
|
+
opt.on('', '--drop-table-only') { options[:drop_table_only] = true }
|
140
140
|
opt.on('', '--mysql-change-table-options') { options[:mysql_change_table_options] = true }
|
141
141
|
opt.on('', '--mysql-change-table-comment') { options[:mysql_change_table_comment] = true }
|
142
142
|
opt.on('', '--check-relation-type DEF_PK') { |v| options[:check_relation_type] = v }
|
@@ -265,15 +265,13 @@ begin
|
|
265
265
|
else
|
266
266
|
File.open(diff_file)
|
267
267
|
end
|
268
|
-
|
268
|
+
else
|
269
269
|
YAML.safe_load(
|
270
270
|
diff_file,
|
271
271
|
permitted_classes: [],
|
272
272
|
permitted_symbols: [],
|
273
273
|
aliases: true
|
274
274
|
)
|
275
|
-
else
|
276
|
-
YAML.safe_load(diff_file, [], [], true)
|
277
275
|
end
|
278
276
|
end
|
279
277
|
|
data/lib/ridgepole/cli/config.rb
CHANGED
@@ -13,15 +13,13 @@ module Ridgepole
|
|
13
13
|
parse_config_file(config)
|
14
14
|
elsif (expanded = File.expand_path(config)) && File.exist?(expanded)
|
15
15
|
parse_config_file(expanded)
|
16
|
-
|
16
|
+
else
|
17
17
|
YAML.safe_load(
|
18
18
|
ERB.new(config).result,
|
19
19
|
permitted_classes: [],
|
20
20
|
permitted_symbols: [],
|
21
21
|
aliases: true
|
22
22
|
)
|
23
|
-
else
|
24
|
-
YAML.safe_load(ERB.new(config).result, [], [], true)
|
25
23
|
end
|
26
24
|
|
27
25
|
parsed_config = parse_database_url(config) unless parsed_config.is_a?(Hash)
|
@@ -39,17 +37,12 @@ module Ridgepole
|
|
39
37
|
|
40
38
|
def parse_config_file(path)
|
41
39
|
yaml = ERB.new(File.read(path)).result
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
aliases: true
|
49
|
-
)
|
50
|
-
else
|
51
|
-
YAML.safe_load(yaml, [], [], true)
|
52
|
-
end
|
40
|
+
YAML.safe_load(
|
41
|
+
yaml,
|
42
|
+
permitted_classes: [],
|
43
|
+
permitted_symbols: [],
|
44
|
+
aliases: true
|
45
|
+
)
|
53
46
|
end
|
54
47
|
|
55
48
|
def parse_database_url(config)
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -28,12 +28,14 @@ module Ridgepole
|
|
28
28
|
if (from_attrs = from.delete(table_name))
|
29
29
|
@logger.verbose_info("# #{table_name}")
|
30
30
|
|
31
|
-
unless
|
32
|
-
|
33
|
-
|
31
|
+
unless @options[:drop_table_only]
|
32
|
+
unless (attrs_delta = diff_inspect(from_attrs, to_attrs)).empty?
|
33
|
+
@logger.verbose_info(attrs_delta)
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
36
|
+
scan_change(table_name, from_attrs, to_attrs, delta)
|
37
|
+
end
|
38
|
+
elsif !@options[:drop_table_only]
|
37
39
|
delta[:add] ||= {}
|
38
40
|
delta[:add][table_name] = to_attrs
|
39
41
|
end
|
@@ -41,7 +43,7 @@ module Ridgepole
|
|
41
43
|
|
42
44
|
scan_relation_info(relation_info)
|
43
45
|
|
44
|
-
if !@options[:merge] && @options[:force_drop_table]
|
46
|
+
if !@options[:merge] && (@options[:force_drop_table] || @options[:drop_table_only])
|
45
47
|
from.each do |table_name, from_attrs|
|
46
48
|
next unless target?(table_name)
|
47
49
|
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -39,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
39
39
|
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
40
40
|
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.2.0'
|
41
41
|
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
|
42
|
-
spec.add_development_dependency 'rubocop', '1.
|
42
|
+
spec.add_development_dependency 'rubocop', '1.63.1'
|
43
43
|
spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
|
44
44
|
spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
|
45
45
|
spec.add_development_dependency 'simplecov'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -218,14 +218,14 @@ dependencies:
|
|
218
218
|
requirements:
|
219
219
|
- - '='
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version: 1.
|
221
|
+
version: 1.63.1
|
222
222
|
type: :development
|
223
223
|
prerelease: false
|
224
224
|
version_requirements: !ruby/object:Gem::Requirement
|
225
225
|
requirements:
|
226
226
|
- - '='
|
227
227
|
- !ruby/object:Gem::Version
|
228
|
-
version: 1.
|
228
|
+
version: 1.63.1
|
229
229
|
- !ruby/object:Gem::Dependency
|
230
230
|
name: rubocop-rake
|
231
231
|
requirement: !ruby/object:Gem::Requirement
|