ridgepole 0.7.1.beta3 → 0.7.1.beta4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a71e8eef1bd9b0c5cc4380f107084a563422b7d
4
- data.tar.gz: 5ddebfde7e3f1402fa89e3e683649cee8f19f01f
3
+ metadata.gz: 573f4b844c5ea5951efd6c7a5807300a79545121
4
+ data.tar.gz: f94d8891b7acc9b42106bd2ccd7e08f8771f922a
5
5
  SHA512:
6
- metadata.gz: 80da7be8ba5725b1e84d7a1a46d766d4e56fa1be89ccbe105b4ff298dc513db355b59c6847a59f4e3f6690c5e0fb4c9ac5113e74b58bc4af751a2b36ca907b77
7
- data.tar.gz: 40a60f8c765b3fa48025fa8067d8258a0c173b117decf3518bbecc8575fba4fad87cb613eb55800c0618eead0dca17fa01b2ff3f74e523940a514d84d5e962b9
6
+ metadata.gz: d5f191e59ef592721209cc97a4f1d019297d5d6d042e9f504665c365d35a3a55cbb4480fc6345966dc227fb35229e9012fbe866beb3e4641944d6d82f675b3f9
7
+ data.tar.gz: 693ab38c2cb409e988311872ee9e7586b10d834a654077d98b235c7cb8f10b8339a05cf7e8036dc7518ab8ae176d7555841ead84d61d59613fbddc088d4cbd74
data/README.md CHANGED
@@ -81,6 +81,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
81
81
  * Add `--ignore-table-comment` option
82
82
  * `>= 0.7.1`
83
83
  * Remove `--reverse` option
84
+ * Add `--allow-pk-change` option
85
+ * Add `--create-table-with-index` option
84
86
 
85
87
  ## Installation
86
88
 
data/bin/ridgepole CHANGED
@@ -125,6 +125,7 @@ ARGV.options do |opt|
125
125
  opt.on('', '--ignore-table-comment') { options[:ignore_table_comment] = true }
126
126
  opt.on('', '--skip-column-comment-change') { options[:skip_column_comment_change] = true }
127
127
  opt.on('', '--allow-pk-change') { options[:allow_pk_change] = true }
128
+ opt.on('', '--create-table-with-index') { options[:create_table_with_index] = true }
128
129
  opt.on('-r', '--require LIBS', Array) {|v| v.each {|i| require i } }
129
130
  opt.on('' , '--log-file LOG_FILE') {|v| options[:log_file] = v }
130
131
  opt.on('' , '--verbose') { Ridgepole::Logger.verbose = true }
@@ -235,11 +235,17 @@ create_table(#{table_name.inspect}, #{inspect_options_include_default_proc(optio
235
235
  EOS
236
236
  end
237
237
 
238
+ if @options[:create_table_with_index] and not indices.empty?
239
+ indices.each do |index_name, index_attrs|
240
+ append_add_index(table_name, index_name, index_attrs, buf, true)
241
+ end
242
+ end
243
+
238
244
  buf.puts(<<-EOS)
239
245
  end
240
246
  EOS
241
247
 
242
- unless indices.empty?
248
+ if not @options[:create_table_with_index] and not indices.empty?
243
249
  append_change_table(table_name, buf) do
244
250
  indices.each do |index_name, index_attrs|
245
251
  append_add_index(table_name, index_name, index_attrs, buf)
@@ -407,11 +413,11 @@ remove_column(#{table_name.inspect}, #{column_name.inspect})
407
413
  end
408
414
  end
409
415
 
410
- def append_add_index(table_name, index_name, attrs, buf)
416
+ def append_add_index(table_name, index_name, attrs, buf, force_bulk_change = false)
411
417
  column_name = attrs.fetch(:column_name)
412
418
  options = attrs[:options] || {}
413
419
 
414
- if @options[:bulk_change]
420
+ if force_bulk_change or @options[:bulk_change]
415
421
  buf.puts(<<-EOS)
416
422
  t.index(#{column_name.inspect}, #{options.inspect})
417
423
  EOS
@@ -1,3 +1,3 @@
1
1
  module Ridgepole
2
- VERSION = '0.7.1.beta3'
2
+ VERSION = '0.7.1.beta4'
3
3
  end
@@ -50,6 +50,7 @@ describe 'ridgepole' do
50
50
  --ignore-table-comment
51
51
  --skip-column-comment-change
52
52
  --allow-pk-change
53
+ --create-table-with-index
53
54
  -r, --require LIBS
54
55
  --log-file LOG_FILE
55
56
  --verbose
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: 0.7.1.beta3
4
+ version: 0.7.1.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-17 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -389,7 +389,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
389
389
  version: 1.3.1
390
390
  requirements: []
391
391
  rubyforge_project:
392
- rubygems_version: 2.5.2
392
+ rubygems_version: 2.6.13
393
393
  signing_key:
394
394
  specification_version: 4
395
395
  summary: Ridgepole is a tool to manage DB schema.