ridgepole 0.9.0.beta → 0.9.0.rc1

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.
Files changed (124) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +19 -1
  3. data/.simplecov +6 -0
  4. data/README.md +4 -26
  5. data/bin/ridgepole +0 -2
  6. data/lib/ridgepole/diff.rb +7 -11
  7. data/lib/ridgepole/dsl_parser/table_definition.rb +1 -1
  8. data/lib/ridgepole/version.rb +1 -1
  9. data/ridgepole.gemspec +2 -1
  10. data/spec/erb_helper.rb +1 -5
  11. data/spec/mysql/bigint_pk/int_pk_spec.rb +1 -1
  12. data/spec/mysql/collation/collation_spec.rb +14 -14
  13. data/spec/mysql/comment/comment_spec.rb +9 -9
  14. data/spec/mysql/diff/diff2_spec.rb +5 -5
  15. data/spec/mysql/diff/diff_spec.rb +3 -3
  16. data/spec/mysql/dump/dump_class_method_spec.rb +12 -12
  17. data/spec/mysql/dump/dump_some_tables_spec.rb +4 -4
  18. data/spec/mysql/dump/dump_spec.rb +12 -12
  19. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -2
  20. data/spec/mysql/dump/dump_without_table_options_spec.rb +1 -1
  21. data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -2
  22. data/spec/mysql/fk/migrate_change_fk_spec.rb +20 -20
  23. data/spec/mysql/fk/migrate_create_fk_spec.rb +18 -18
  24. data/spec/mysql/fk/migrate_drop_fk_spec.rb +26 -26
  25. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +16 -16
  26. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +6 -6
  27. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -2
  28. data/spec/mysql/migrate/migrate_add_column_spec.rb +18 -18
  29. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +21 -21
  30. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +18 -18
  31. data/spec/mysql/migrate/migrate_change_column2_spec.rb +5 -5
  32. data/spec/mysql/migrate/migrate_change_column3_spec.rb +10 -10
  33. data/spec/mysql/migrate/migrate_change_column5_spec.rb +3 -3
  34. data/spec/mysql/migrate/migrate_change_column6_spec.rb +7 -7
  35. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -14
  36. data/spec/mysql/migrate/migrate_change_column_spec.rb +21 -21
  37. data/spec/mysql/migrate/migrate_change_index2_spec.rb +5 -5
  38. data/spec/mysql/migrate/migrate_change_index3_spec.rb +7 -7
  39. data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
  40. data/spec/mysql/migrate/migrate_change_index5_spec.rb +4 -4
  41. data/spec/mysql/migrate/migrate_change_index6_spec.rb +27 -27
  42. data/spec/mysql/migrate/migrate_change_index7_spec.rb +4 -4
  43. data/spec/mysql/migrate/migrate_change_index8_spec.rb +4 -4
  44. data/spec/mysql/migrate/migrate_change_index_spec.rb +27 -27
  45. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  46. data/spec/mysql/migrate/migrate_create_index2_spec.rb +24 -24
  47. data/spec/mysql/migrate/migrate_create_index_spec.rb +18 -18
  48. data/spec/mysql/migrate/migrate_create_table_spec.rb +16 -16
  49. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +4 -4
  50. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +4 -4
  51. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +16 -16
  52. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +18 -18
  53. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +16 -16
  54. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +1 -1
  55. data/spec/mysql/migrate/migrate_drop_column_spec.rb +18 -18
  56. data/spec/mysql/migrate/migrate_drop_index_spec.rb +15 -15
  57. data/spec/mysql/migrate/migrate_drop_table_spec.rb +16 -16
  58. data/spec/mysql/migrate/migrate_empty_spec.rb +9 -9
  59. data/spec/mysql/migrate/migrate_execute_spec.rb +32 -32
  60. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +4 -4
  61. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +5 -5
  62. data/spec/mysql/migrate/migrate_log_file_spec.rb +16 -16
  63. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +18 -18
  64. data/spec/mysql/migrate/migrate_noop_spec.rb +12 -12
  65. data/spec/mysql/migrate/migrate_primary_key_spec.rb +1 -1
  66. data/spec/mysql/migrate/migrate_rename_column_spec.rb +18 -18
  67. data/spec/mysql/migrate/migrate_rename_table_spec.rb +22 -22
  68. data/spec/mysql/migrate/migrate_same_spec.rb +12 -12
  69. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -2
  70. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +18 -18
  71. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +18 -18
  72. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +18 -18
  73. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +18 -18
  74. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +1 -1
  75. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +6 -6
  76. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
  77. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +8 -8
  78. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +5 -5
  79. data/spec/mysql57/json/add_json_column_spec.rb +2 -2
  80. data/spec/mysql57/json/change_json_column_spec.rb +6 -6
  81. data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
  82. data/spec/mysql57/virtual/add_virtual_column_spec.rb +1 -1
  83. data/spec/mysql57/virtual/change_virtual_column_spec.rb +1 -1
  84. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +1 -1
  85. data/spec/postgresql/dump/dump_spec.rb +12 -12
  86. data/spec/postgresql/fk/migrate_change_fk_spec.rb +6 -6
  87. data/spec/postgresql/fk/migrate_create_fk_spec.rb +5 -5
  88. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +8 -8
  89. data/spec/postgresql/migrate/migrate_add_column_spec.rb +16 -16
  90. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +1 -1
  91. data/spec/postgresql/migrate/migrate_change_column_spec.rb +16 -16
  92. data/spec/postgresql/migrate/migrate_change_index_spec.rb +18 -18
  93. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +1 -1
  94. data/spec/postgresql/migrate/migrate_create_table_spec.rb +14 -14
  95. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +18 -18
  96. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +17 -17
  97. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +3 -3
  98. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +15 -15
  99. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +16 -16
  100. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +1 -1
  101. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +1 -1
  102. data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
  103. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +18 -18
  104. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +20 -20
  105. data/spec/postgresql/migrate/migrate_same_spec.rb +12 -12
  106. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +3 -3
  107. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
  108. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +4 -4
  109. data/spec/processing_for_ci.rb +13 -0
  110. data/spec/spec_helper.rb +1 -1
  111. metadata +33 -31
  112. data/omnibus-ridgepole/.gitignore +0 -10
  113. data/omnibus-ridgepole/Dockerfile.centos +0 -25
  114. data/omnibus-ridgepole/Dockerfile.ubuntu +0 -21
  115. data/omnibus-ridgepole/Gemfile +0 -24
  116. data/omnibus-ridgepole/README.md +0 -15
  117. data/omnibus-ridgepole/Rakefile +0 -38
  118. data/omnibus-ridgepole/config/projects/ridgepole.rb +0 -27
  119. data/omnibus-ridgepole/config/software/ridgepole.rb +0 -13
  120. data/omnibus-ridgepole/omnibus.rb +0 -54
  121. data/omnibus-ridgepole/package-scripts/ridgepole/postinst +0 -1
  122. data/omnibus-ridgepole/package-scripts/ridgepole/postrm +0 -1
  123. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +0 -47
  124. data/spec/processing_for_travis.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df81adabc9afddf2d409c647190e217dd71a3948b8d3b9c3753f36c8519df701
4
- data.tar.gz: 3df1478fbdaa3ef5ac2ac192cf1a022901753f1f4adac72f20b93f17b49dcb2d
3
+ metadata.gz: 10f8b6443da2ed263c957eb68325c4fa6d96ff3e5b0b8b0c32970c39a70e7fdb
4
+ data.tar.gz: f46637323aee71ad24e87c0fed171ecdf96903a0f43bb20aea270db5e454b609
5
5
  SHA512:
6
- metadata.gz: ae3fa69120a6ba5103f512092694abd151073ae3e7ed27c23677aa9f617b4a986565c29e6088fbb0f4ae1a0da0cfc425b5c67c8e8b1b19b956164dd8c7fcdf87
7
- data.tar.gz: bce34561a3ac8489bbc3466e7d63fd0c4c4a557659e28751bfc06fe3f058d3725493c34426cab2a1171ea86e1e35d4fdde8be3b1e31186599a73748a3a2563a3
6
+ metadata.gz: dbf4ef4b329627688da0d8ae61e3190ab3773c4b6b9e3d46b55b481db5ece42fcba73395f2f2b4980430930479fea27ce039c51892e981b2cf7e55276e36dbac
7
+ data.tar.gz: 9d4dd03ace90b791ffd33924204cb785491569a859227db9bd0e18f186e27b716f325663249625bba378608a0e3c3fadedbeb306e9cf03634af19adf010db491
@@ -60,6 +60,24 @@ jobs:
60
60
  env:
61
61
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
62
62
 
63
- - run: ${{ matrix.env }} bundle exec rake
63
+ - name: Run tests
64
+ run: ${{ matrix.env }} bundle exec rake
64
65
  env:
65
66
  BUNDLE_GEMFILE: ${{ matrix.gemfile }}
67
+
68
+ - name: Coveralls Parallel
69
+ uses: coverallsapp/github-action@v1.1.2
70
+ with:
71
+ github-token: ${{ secrets.GITHUB_TOKEN }}
72
+ flag-name: run-${{ matrix.ruby }}-${{ matrix.env }}-${{ matrix.gemfile }}
73
+ parallel: true
74
+
75
+ finish:
76
+ needs: build
77
+ runs-on: ubuntu-latest
78
+ steps:
79
+ - name: Coveralls Finished
80
+ uses: coverallsapp/github-action@v1.1.2
81
+ with:
82
+ github-token: ${{ secrets.GITHUB_TOKEN }}
83
+ parallel-finished: true
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ SimpleCov.start do
4
+ # exclude directories and files
5
+ add_filter '/spec/'
6
+ end
data/README.md CHANGED
@@ -6,8 +6,9 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
6
6
  (like Chef/Puppet)
7
7
 
8
8
  [![Gem Version](https://badge.fury.io/rb/ridgepole.svg)](http://badge.fury.io/rb/ridgepole)
9
+ [![Unstable Version](https://img.shields.io/badge/unstable-0.9.0.beta-brightgreen.svg?longCache=true&style=flat)](https://rubygems.org/gems/ridgepole/versions/0.9.0.beta)
9
10
  [![Build Status](https://github.com/winebarrel/ridgepole/workflows/test/badge.svg?branch=0.9)](https://github.com/winebarrel/ridgepole/actions)
10
- [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.9)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.8)
11
+ [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.9)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.9)
11
12
 
12
13
  <details><summary>ChangeLog</summary>
13
14
 
@@ -131,8 +132,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
131
132
  * Remove `--mysql-alter-index` option ([pull#330](https://github.com/winebarrel/ridgepole/pull/330))
132
133
  * Add `--table-hash-options` option ([pull#331](https://github.com/winebarrel/ridgepole/pull/331))
133
134
  * Support Rails 6.1 ([pull#323](https://github.com/winebarrel/ridgepole/pull/323))
134
- * Disable Rails 5.0 support([pull#335](https://github.com/winebarrel/ridgepole/pull/335))
135
- * Fix PK AUTO_INCREMENT change bug([pull#334](https://github.com/winebarrel/ridgepole/pull/334))
135
+ * Disable Rails 5.0 support ([pull#335](https://github.com/winebarrel/ridgepole/pull/335))
136
+ * Fix PK AUTO_INCREMENT change bug ([pull#334](https://github.com/winebarrel/ridgepole/pull/334))
136
137
  </details>
137
138
 
138
139
  **Notice**
@@ -157,26 +158,6 @@ Or install it yourself as:
157
158
 
158
159
  $ gem install ridgepole
159
160
 
160
- ## Omnibus Package (deb/rpm)
161
-
162
- see https://github.com/winebarrel/ridgepole/releases.
163
-
164
- ### Install from deb
165
-
166
- ```sh
167
- sudo dpkg -i ridgepole_x.x.x+xxx-x_amd64.deb
168
- sudo apt install build-essential libmysqlclient-dev
169
- sudo /opt/ridgepole/embedded/bin/gem install mysql2
170
- ```
171
-
172
- ### Install from rpm
173
-
174
- ```sh
175
- sudo yum install ridgepole-x.x.x+xxx-x.el7.x86_64.rpm
176
- sudo yum install make gcc mariadb-devel
177
- sudo /opt/ridgepole/embedded/bin/gem install mysql2
178
- ```
179
-
180
161
  ## Help
181
162
  ```
182
163
  Usage: ridgepole [options]
@@ -466,6 +447,3 @@ bundle exec appraisal activerecord-5.1 rake
466
447
  * https://github.com/winebarrel/ridgepole-example
467
448
  * https://github.com/winebarrel/ridgepole-example/pull/1
468
449
  * https://github.com/winebarrel/ridgepole-example/pull/2
469
-
470
- ## Similar tools
471
- * [Codenize.tools](http://codenize.tools/)
@@ -147,8 +147,6 @@ ARGV.options do |opt|
147
147
  opt.on('', '--create-table-with-index') { options[:create_table_with_index] = true }
148
148
 
149
149
  opt.on('', '--mysql-dump-auto-increment') do
150
- raise OptionParser::InvalidOption, '`mysql-dump-auto-increment` is not available in `activerecord < 5.1`' if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('5.1')
151
-
152
150
  options[:mysql_dump_auto_increment] = true
153
151
  end
154
152
 
@@ -159,7 +159,7 @@ module Ridgepole
159
159
  to.delete(:collation)
160
160
  end
161
161
 
162
- pk_attrs = build_primary_key_attrs_if_changed(from, to, table_name)
162
+ pk_attrs = build_primary_key_attrs_if_changed(from, to)
163
163
  if pk_attrs
164
164
  if @options[:allow_pk_change]
165
165
  if from[:id] == false
@@ -207,20 +207,20 @@ module Ridgepole
207
207
  { type: type, options: options }
208
208
  end
209
209
 
210
- def build_attrs_if_changed(to_attrs, from_attrs, table_name, primary_key: false)
210
+ def build_attrs_if_changed(to_attrs, from_attrs, primary_key: false)
211
211
  normalize_column_options!(from_attrs, primary_key)
212
212
  normalize_column_options!(to_attrs, primary_key)
213
213
 
214
- new_to_attrs = fix_change_column_options(table_name, from_attrs, to_attrs) unless compare_column_attrs(from_attrs, to_attrs)
214
+ new_to_attrs = fix_change_column_options(from_attrs, to_attrs) unless compare_column_attrs(from_attrs, to_attrs)
215
215
  new_to_attrs
216
216
  end
217
217
 
218
- def build_primary_key_attrs_if_changed(from, to, table_name)
218
+ def build_primary_key_attrs_if_changed(from, to)
219
219
  from_column_attrs = convert_to_primary_key_attrs(from.slice(*PRIMARY_KEY_OPTIONS))
220
220
  to_column_attrs = convert_to_primary_key_attrs(to.slice(*PRIMARY_KEY_OPTIONS))
221
221
  return if from_column_attrs == to_column_attrs
222
222
 
223
- build_attrs_if_changed(to_column_attrs, from_column_attrs, table_name, primary_key: true)
223
+ build_attrs_if_changed(to_column_attrs, from_column_attrs, primary_key: true)
224
224
  end
225
225
 
226
226
  def scan_definition_change(from, to, from_indices, table_name, table_options, table_delta)
@@ -242,7 +242,7 @@ module Ridgepole
242
242
  next if ignore_column
243
243
 
244
244
  if from_attrs
245
- to_attrs = build_attrs_if_changed(to_attrs, from_attrs, table_name)
245
+ to_attrs = build_attrs_if_changed(to_attrs, from_attrs)
246
246
  if to_attrs
247
247
  definition_delta[:change] ||= {}
248
248
  definition_delta[:change][column_name] = to_attrs
@@ -471,7 +471,7 @@ module Ridgepole
471
471
  # XXX: MySQL only?
472
472
  # https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L760
473
473
  # https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb#L102
474
- def fix_change_column_options(table_name, from_attrs, to_attrs)
474
+ def fix_change_column_options(from_attrs, to_attrs)
475
475
  # default: 0, null: false -> default: nil, null: false | default: nil
476
476
  # default: 0, null: false -> null: false | default: nil
477
477
  # default: 0, null: false -> default: nil, null: true | default: nil, null: true
@@ -486,10 +486,6 @@ module Ridgepole
486
486
  to_attrs[:options].delete(:null)
487
487
  end
488
488
 
489
- if Ridgepole::ConnectionAdapters.mysql? && ActiveRecord::VERSION::STRING.start_with?('5.0.')
490
- Ridgepole::Logger.instance.warn("[WARNING] Table `#{table_name}`: `default: nil` is ignored when `null: false`. Please apply twice") if to_attrs[:options][:default].nil? && (to_attrs[:options][:null] == false)
491
- end
492
-
493
489
  to_attrs
494
490
  end
495
491
 
@@ -20,7 +20,7 @@ module Ridgepole
20
20
  }
21
21
  end
22
22
 
23
- DEFAULT_PRIMARY_KEY_TYPE = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.1') ? :bigint : :integer
23
+ DEFAULT_PRIMARY_KEY_TYPE = :bigint
24
24
 
25
25
  TYPES = {
26
26
  # https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ridgepole
4
- VERSION = '0.9.0.beta'
4
+ VERSION = '0.9.0.rc1'
5
5
  end
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_development_dependency 'appraisal', '>= 2.2.0'
28
28
  spec.add_development_dependency 'bundler'
29
- spec.add_development_dependency 'coveralls'
30
29
  spec.add_development_dependency 'erbh', '>= 0.1.2'
31
30
  spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
32
31
  spec.add_development_dependency 'hash_order_helper', '>= 0.1.6'
@@ -39,4 +38,6 @@ Gem::Specification.new do |spec|
39
38
  spec.add_development_dependency 'rubocop', '>= 1.7.0'
40
39
  spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
41
40
  spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
41
+ spec.add_development_dependency 'simplecov'
42
+ spec.add_development_dependency 'simplecov-lcov'
42
43
  end
@@ -14,11 +14,7 @@ ERBh.define_method(:i) do |obj|
14
14
  end
15
15
 
16
16
  ERBh.define_method(:cond) do |conds, m, e = nil|
17
- if conds.is_a?(Hash)
18
- conds.find do |c, _|
19
- condition(c)
20
- end&.last || m
21
- elsif condition(conds)
17
+ if condition(conds)
22
18
  m
23
19
  else
24
20
  e || (begin
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- describe 'Ridgepole::Client (with integer pk)', condition: '>= 5.1.0' do
3
+ describe 'Ridgepole::Client (with integer pk)' do
4
4
  context 'when with id:integer' do
5
5
  let(:dsl) do
6
6
  <<-RUBY
@@ -4,22 +4,22 @@ describe 'Ridgepole::Client#diff -> migrate' do
4
4
  context 'when change column (add collation)' do
5
5
  let(:actual_dsl) do
6
6
  erbh(<<-ERB)
7
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
7
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
8
8
  t.integer "emp_no", null: false
9
9
  t.integer "club_id", null: false, unsigned: true
10
10
  t.string "string", null: false, collation: "ascii_bin"
11
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false
11
+ t.text "text", null: false
12
12
  end
13
13
  ERB
14
14
  end
15
15
 
16
16
  let(:expected_dsl) do
17
17
  erbh(<<-ERB)
18
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
18
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
19
19
  t.integer "emp_no", null: false
20
20
  t.integer "club_id", null: false, unsigned: true
21
21
  t.string "string", null: false, collation: "ascii_bin"
22
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, collation: "utf8mb4_bin"
22
+ t.text "text", null: false, collation: "utf8mb4_bin"
23
23
  end
24
24
  ERB
25
25
  end
@@ -39,22 +39,22 @@ describe 'Ridgepole::Client#diff -> migrate' do
39
39
  context 'when change column (delete collation)' do
40
40
  let(:actual_dsl) do
41
41
  erbh(<<-ERB)
42
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
42
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
43
43
  t.integer "emp_no", null: false
44
44
  t.integer "club_id", null: false, unsigned: true
45
45
  t.string "string", null: false, collation: "ascii_bin"
46
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, collation: "utf8mb4_bin"
46
+ t.text "text", null: false, collation: "utf8mb4_bin"
47
47
  end
48
48
  ERB
49
49
  end
50
50
 
51
51
  let(:expected_dsl) do
52
52
  erbh(<<-ERB)
53
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
53
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
54
54
  t.integer "emp_no", null: false
55
55
  t.integer "club_id", null: false, unsigned: true
56
56
  t.string "string", null: false, collation: "ascii_bin"
57
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false
57
+ t.text "text", null: false
58
58
  end
59
59
  ERB
60
60
  end
@@ -74,22 +74,22 @@ describe 'Ridgepole::Client#diff -> migrate' do
74
74
  context 'when change column (change collation)' do
75
75
  let(:actual_dsl) do
76
76
  erbh(<<-ERB)
77
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
77
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
78
78
  t.integer "emp_no", null: false
79
79
  t.integer "club_id", null: false, unsigned: true
80
80
  t.string "string", null: false, collation: "ascii_bin"
81
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, collation: "utf8mb4_bin"
81
+ t.text "text", null: false, collation: "utf8mb4_bin"
82
82
  end
83
83
  ERB
84
84
  end
85
85
 
86
86
  let(:expected_dsl) do
87
87
  erbh(<<-ERB)
88
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
88
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
89
89
  t.integer "emp_no", null: false
90
90
  t.integer "club_id", null: false, unsigned: true
91
91
  t.string "string", null: false, collation: "utf8mb4_bin"
92
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, collation: "ascii_bin"
92
+ t.text "text", null: false, collation: "ascii_bin"
93
93
  end
94
94
  ERB
95
95
  end
@@ -109,11 +109,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
109
109
  context 'when change column (no change collation)' do
110
110
  let(:actual_dsl) do
111
111
  erbh(<<-ERB)
112
- create_table "employee_clubs", <%= i cond({ ">= 5.1, < 6.1" => { id: :bigint, unsigned: true }, ">= 6.1" => { id: { type: :bigint, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
112
+ create_table "employee_clubs", <%= i cond("< 6.1", { id: :bigint, unsigned: true }, { id: { type: :bigint, unsigned: true } }) %>, force: :cascade do |t|
113
113
  t.integer "emp_no", null: false
114
114
  t.integer "club_id", null: false, unsigned: true
115
115
  t.string "string", null: false, collation: "ascii_bin"
116
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, collation: "utf8mb4_bin"
116
+ t.text "text", null: false, collation: "utf8mb4_bin"
117
117
  end
118
118
  ERB
119
119
  end
@@ -8,7 +8,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
8
8
  t.integer "emp_no", null: false
9
9
  t.integer "club_id", null: false
10
10
  t.string "string", null: false
11
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false
11
+ t.text "text", null: false
12
12
  end
13
13
  ERB
14
14
  end
@@ -19,7 +19,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
19
19
  t.integer "emp_no", null: false, comment: "any comment"
20
20
  t.integer "club_id", null: false, comment: "any comment2"
21
21
  t.string "string", null: false, comment: "any comment3"
22
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "any comment4"
22
+ t.text "text", null: false, comment: "any comment4"
23
23
  end
24
24
  ERB
25
25
  end
@@ -43,7 +43,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
43
43
  t.integer "emp_no", null: false, comment: "any comment"
44
44
  t.integer "club_id", null: false, comment: "any comment2"
45
45
  t.string "string", null: false, comment: "any comment3"
46
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "any comment4"
46
+ t.text "text", null: false, comment: "any comment4"
47
47
  end
48
48
  ERB
49
49
  end
@@ -54,7 +54,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
54
54
  t.integer "emp_no", null: false
55
55
  t.integer "club_id", null: false
56
56
  t.string "string", null: false
57
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false
57
+ t.text "text", null: false
58
58
  end
59
59
  ERB
60
60
  end
@@ -78,7 +78,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
78
78
  t.integer "emp_no", null: false, comment: "any comment"
79
79
  t.integer "club_id", null: false, comment: "any comment2"
80
80
  t.string "string", null: false, comment: "any comment3"
81
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "any comment4"
81
+ t.text "text", null: false, comment: "any comment4"
82
82
  end
83
83
  ERB
84
84
  end
@@ -89,7 +89,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
89
89
  t.integer "emp_no", null: false, comment: "other comment"
90
90
  t.integer "club_id", null: false, comment: "other comment2"
91
91
  t.string "string", null: false, comment: "other comment3"
92
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "other comment4"
92
+ t.text "text", null: false, comment: "other comment4"
93
93
  end
94
94
  ERB
95
95
  end
@@ -113,7 +113,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
113
113
  t.integer "emp_no", null: false, comment: "any comment"
114
114
  t.integer "club_id", null: false, comment: "any comment2"
115
115
  t.string "string", null: false, comment: "any comment3"
116
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "any comment4"
116
+ t.text "text", null: false, comment: "any comment4"
117
117
  end
118
118
  ERB
119
119
  end
@@ -137,7 +137,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
137
137
  t.integer "emp_no", null: false, comment: "other comment"
138
138
  t.integer "club_id", null: false, comment: "other comment2"
139
139
  t.string "string", null: false, comment: "other comment3"
140
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "other comment4"
140
+ t.text "text", null: false, comment: "other comment4"
141
141
  end
142
142
  ERB
143
143
  end
@@ -160,7 +160,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
160
160
  t.integer "emp_no", null: false, comment: "other comment"
161
161
  t.integer "club_id", null: false, comment: "other comment2"
162
162
  t.string "string", null: false, comment: "other comment3"
163
- t.text "text", <%= i cond(5.0, limit: 65535) %>, null: false, comment: "other comment4"
163
+ t.text "text", null: false, comment: "other comment4"
164
164
  end
165
165
  ERB
166
166
  end
@@ -174,12 +174,12 @@ describe 'Ridgepole::Client.diff' do
174
174
  it {
175
175
  delta = subject.diff(actual_dsl, expected_dsl)
176
176
  expect(delta.differ?).to be_truthy
177
- expect(delta.script).to match_ruby erbh(<<-ERB)
178
- change_column("employee_clubs", "club_id", :integer, **<%= {:unsigned=>false, :null=>true, :default=>nil} + cond('>= 5.1', comment: nil) %>)
177
+ expect(delta.script).to match_ruby(<<-RUBY)
178
+ change_column("employee_clubs", "club_id", :integer, **{:unsigned=>false, :null=>true, :default=>nil, :comment=>nil})
179
179
 
180
- change_column("employees", "last_name", :string, **<%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
181
- change_column("employees", "gender", :string, **<%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
182
- ERB
180
+ change_column("employees", "last_name", :string, **{:limit=>20, :default=>"XXX", :unsigned=>false, :comment=>nil})
181
+ change_column("employees", "gender", :string, **{:limit=>2, :null=>false, :default=>nil, :unsigned=>false, :comment=>nil})
182
+ RUBY
183
183
  }
184
184
 
185
185
  after do
@@ -149,10 +149,10 @@ describe 'Ridgepole::Client.diff' do
149
149
  delta = subject.diff(actual_dsl, expected_dsl)
150
150
  expect(delta.differ?).to be_truthy
151
151
  expect(delta.script).to match_ruby erbh(<<-ERB)
152
- change_column("employee_clubs", "club_id", :integer, **<%= {:unsigned=>false, :null=>true, :default=>nil} + cond('>= 5.1', comment: nil) %>)
152
+ change_column("employee_clubs", "club_id", :integer, **{:unsigned=>false, :null=>true, :default=>nil, :comment=>nil})
153
153
 
154
- change_column("employees", "last_name", :string, **<%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
155
- change_column("employees", "gender", :string, **<%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
154
+ change_column("employees", "last_name", :string, **{:limit=>20, :default=>"XXX", :unsigned=>false, :comment=>nil})
155
+ change_column("employees", "gender", :string, **{:limit=>2, :null=>false, :default=>nil, :unsigned=>false, :comment=>nil})
156
156
  ERB
157
157
  }
158
158
  end
@@ -7,14 +7,14 @@ describe 'Ridgepole::Client.dump' do
7
7
 
8
8
  it {
9
9
  expect(subject.dump(conn_spec, dump_without_table_options: true)).to match_fuzzy erbh(<<-ERB)
10
- create_table "clubs", <%= i cond({ '>= 5.1, < 6.1' => { id: :integer, unsigned: true }, ">= 6.1" => { id: { type: :integer, unsigned: true } } }, { unsigned: true }) %>, force: :cascade do |t|
10
+ create_table "clubs", <%= i cond('< 6.1', { id: :integer, unsigned: true }, { id: { type: :integer, unsigned: true } }) %>, force: :cascade do |t|
11
11
  t.string "name", default: "", null: false
12
- t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
12
+ t.index ["name"], name: "idx_name", unique: true
13
13
  end
14
14
 
15
15
  create_table "departments", primary_key: "dept_no", <%= i cond(">= 6.1", { id: { type: :string, limit: 4 } }, { id: :string, limit: 4 }) %>, force: :cascade do |t|
16
16
  t.string "dept_name", limit: 40, null: false
17
- t.index ["dept_name"], name: "dept_name", unique: true, <%= i cond(5.0, using: :btree) %>
17
+ t.index ["dept_name"], name: "dept_name", unique: true
18
18
  end
19
19
 
20
20
  create_table "dept_emp", primary_key: ["emp_no", "dept_no"], force: :cascade do |t|
@@ -22,8 +22,8 @@ describe 'Ridgepole::Client.dump' do
22
22
  t.string "dept_no", limit: 4, null: false
23
23
  t.date "from_date", null: false
24
24
  t.date "to_date", null: false
25
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
26
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
25
+ t.index ["dept_no"], name: "dept_no"
26
+ t.index ["emp_no"], name: "emp_no"
27
27
  end
28
28
 
29
29
  create_table "dept_manager", primary_key: ["emp_no", "dept_no"], force: :cascade do |t|
@@ -31,17 +31,17 @@ describe 'Ridgepole::Client.dump' do
31
31
  t.integer "emp_no", null: false
32
32
  t.date "from_date", null: false
33
33
  t.date "to_date", null: false
34
- t.index ["dept_no"], name: "dept_no", <%= i cond(5.0, using: :btree) %>
35
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
34
+ t.index ["dept_no"], name: "dept_no"
35
+ t.index ["emp_no"], name: "emp_no"
36
36
  end
37
37
 
38
- create_table "employee_clubs", <%= i cond({ '>= 5.1, < 6.1' => { id: :integer, unsigned: true }, ">= 6.1" => { id: { type: :integer, unsigned: true }} }, { unsigned: true }) %>, force: :cascade do |t|
38
+ create_table "employee_clubs", <%= i cond('< 6.1', { id: :integer, unsigned: true }, { id: { type: :integer, unsigned: true }}) %>, force: :cascade do |t|
39
39
  t.integer "emp_no", null: false, unsigned: true
40
40
  t.integer "club_id", null: false, unsigned: true
41
- t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", <%= i cond(5.0, using: :btree) %>
41
+ t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id"
42
42
  end
43
43
 
44
- create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond('>= 5.1', default: nil) %>, force: :cascade do |t|
44
+ create_table "employees", primary_key: "emp_no", id: :integer, default: nil, force: :cascade do |t|
45
45
  t.date "birth_date", null: false
46
46
  t.string "first_name", limit: 14, null: false
47
47
  t.string "last_name", limit: 16, null: false
@@ -58,7 +58,7 @@ describe 'Ridgepole::Client.dump' do
58
58
  t.integer "salary", null: false
59
59
  t.date "from_date", null: false
60
60
  t.date "to_date", null: false
61
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
61
+ t.index ["emp_no"], name: "emp_no"
62
62
  end
63
63
 
64
64
  create_table "titles", primary_key: ["emp_no", "title", "from_date"], force: :cascade do |t|
@@ -66,7 +66,7 @@ describe 'Ridgepole::Client.dump' do
66
66
  t.string "title", limit: 50, null: false
67
67
  t.date "from_date", null: false
68
68
  t.date "to_date"
69
- t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
69
+ t.index ["emp_no"], name: "emp_no"
70
70
  end
71
71
  ERB
72
72
  }