ridgepole 0.8.0.rc1 → 0.8.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/.rubocop.yml +3 -1
  4. data/.travis.yml +4 -5
  5. data/Appraisals +3 -1
  6. data/Gemfile +2 -0
  7. data/README.md +4 -3
  8. data/Rakefile +2 -0
  9. data/bin/ridgepole +4 -2
  10. data/gemfiles/activerecord_6.0.gemfile +1 -1
  11. data/lib/ridgepole.rb +2 -0
  12. data/lib/ridgepole/cli/config.rb +2 -0
  13. data/lib/ridgepole/client.rb +2 -0
  14. data/lib/ridgepole/connection_adapters.rb +2 -0
  15. data/lib/ridgepole/default_limit.rb +2 -0
  16. data/lib/ridgepole/delta.rb +3 -1
  17. data/lib/ridgepole/diff.rb +4 -2
  18. data/lib/ridgepole/dsl_parser.rb +2 -0
  19. data/lib/ridgepole/dsl_parser/context.rb +5 -3
  20. data/lib/ridgepole/dsl_parser/table_definition.rb +2 -0
  21. data/lib/ridgepole/dumper.rb +2 -0
  22. data/lib/ridgepole/execute_expander.rb +4 -2
  23. data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +2 -0
  24. data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +2 -0
  25. data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +2 -0
  26. data/lib/ridgepole/ext/pp_sort_hash.rb +2 -0
  27. data/lib/ridgepole/ext/schema_dumper.rb +2 -0
  28. data/lib/ridgepole/external_sql_executer.rb +2 -0
  29. data/lib/ridgepole/logger.rb +2 -0
  30. data/lib/ridgepole/migration_ext.rb +2 -0
  31. data/lib/ridgepole/schema_dumper_ext.rb +2 -0
  32. data/lib/ridgepole/schema_statements_ext.rb +2 -0
  33. data/lib/ridgepole/version.rb +3 -1
  34. data/ridgepole.gemspec +2 -0
  35. data/spec/cli_helper.rb +2 -0
  36. data/spec/erb_helper.rb +2 -0
  37. data/spec/hide_pending_formatter.rb +2 -0
  38. data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +2 -0
  39. data/spec/mysql/bigint_pk/bigint_pk_spec.rb +2 -0
  40. data/spec/mysql/bigint_pk/int_pk_spec.rb +2 -0
  41. data/spec/mysql/cli/config_spec.rb +2 -0
  42. data/spec/mysql/cli/ridgepole_spec.rb +2 -0
  43. data/spec/mysql/collation/collation_spec.rb +2 -0
  44. data/spec/mysql/comment/comment_spec.rb +2 -0
  45. data/spec/mysql/default_lambda/default_lambda_spec.rb +2 -0
  46. data/spec/mysql/diff/diff2_spec.rb +2 -0
  47. data/spec/mysql/diff/diff_spec.rb +2 -0
  48. data/spec/mysql/dump/dump_class_method_spec.rb +6 -0
  49. data/spec/mysql/dump/dump_some_tables_spec.rb +10 -0
  50. data/spec/mysql/dump/dump_spec.rb +6 -0
  51. data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -0
  52. data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -0
  53. data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -0
  54. data/spec/mysql/fk/migrate_change_fk_spec.rb +2 -0
  55. data/spec/mysql/fk/migrate_create_fk_spec.rb +2 -0
  56. data/spec/mysql/fk/migrate_drop_fk_spec.rb +2 -0
  57. data/spec/mysql/fk/migrate_fk_with_column_spec.rb +163 -0
  58. data/spec/mysql/fk/migrate_ignore_fk_spec.rb +2 -0
  59. data/spec/mysql/migrate/check_orphan_index_spec.rb +2 -0
  60. data/spec/mysql/migrate/migrate_add_column2_spec.rb +2 -0
  61. data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -0
  62. data/spec/mysql/migrate/migrate_add_column_spec.rb +2 -0
  63. data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +2 -0
  64. data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +2 -0
  65. data/spec/mysql/migrate/migrate_change_column2_spec.rb +2 -0
  66. data/spec/mysql/migrate/migrate_change_column3_spec.rb +2 -0
  67. data/spec/mysql/migrate/migrate_change_column4_spec.rb +2 -0
  68. data/spec/mysql/migrate/migrate_change_column5_spec.rb +2 -0
  69. data/spec/mysql/migrate/migrate_change_column6_spec.rb +2 -0
  70. data/spec/mysql/migrate/migrate_change_column7_spec.rb +2 -0
  71. data/spec/mysql/migrate/migrate_change_column8_spec.rb +2 -0
  72. data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -0
  73. data/spec/mysql/migrate/migrate_change_column_float_spec.rb +2 -0
  74. data/spec/mysql/migrate/migrate_change_column_spec.rb +2 -0
  75. data/spec/mysql/migrate/migrate_change_index2_spec.rb +2 -0
  76. data/spec/mysql/migrate/migrate_change_index3_spec.rb +2 -0
  77. data/spec/mysql/migrate/migrate_change_index4_spec.rb +2 -0
  78. data/spec/mysql/migrate/migrate_change_index5_spec.rb +2 -0
  79. data/spec/mysql/migrate/migrate_change_index6_spec.rb +2 -0
  80. data/spec/mysql/migrate/migrate_change_index7_spec.rb +2 -0
  81. data/spec/mysql/migrate/migrate_change_index8_spec.rb +2 -0
  82. data/spec/mysql/migrate/migrate_change_index_spec.rb +2 -0
  83. data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +2 -0
  84. data/spec/mysql/migrate/migrate_change_table_option_spec.rb +2 -0
  85. data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +2 -0
  86. data/spec/mysql/migrate/migrate_create_index2_spec.rb +2 -0
  87. data/spec/mysql/migrate/migrate_create_index_spec.rb +2 -0
  88. data/spec/mysql/migrate/migrate_create_table_spec.rb +2 -0
  89. data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +2 -0
  90. data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +2 -0
  91. data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +2 -0
  92. data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +2 -0
  93. data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +2 -0
  94. data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +2 -0
  95. data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +2 -0
  96. data/spec/mysql/migrate/migrate_drop_column_spec.rb +2 -0
  97. data/spec/mysql/migrate/migrate_drop_index_spec.rb +2 -0
  98. data/spec/mysql/migrate/migrate_drop_table_spec.rb +2 -0
  99. data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +2 -0
  100. data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +2 -0
  101. data/spec/mysql/migrate/migrate_empty_spec.rb +2 -0
  102. data/spec/mysql/migrate/migrate_execute_spec.rb +2 -0
  103. data/spec/mysql/migrate/migrate_ignore_column_spec.rb +2 -0
  104. data/spec/mysql/migrate/migrate_ignore_index_spec.rb +2 -0
  105. data/spec/mysql/migrate/migrate_log_file_spec.rb +2 -0
  106. data/spec/mysql/migrate/migrate_merge_mode_spec.rb +2 -0
  107. data/spec/mysql/migrate/migrate_noop_spec.rb +2 -0
  108. data/spec/mysql/migrate/migrate_primary_key_spec.rb +2 -0
  109. data/spec/mysql/migrate/migrate_rename_column_spec.rb +2 -0
  110. data/spec/mysql/migrate/migrate_rename_table_spec.rb +2 -0
  111. data/spec/mysql/migrate/migrate_same_default_null_spec.rb +2 -0
  112. data/spec/mysql/migrate/migrate_same_spec.rb +6 -0
  113. data/spec/mysql/migrate/migrate_script_error_spec.rb +2 -0
  114. data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -0
  115. data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +2 -0
  116. data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +2 -0
  117. data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +2 -0
  118. data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +2 -0
  119. data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +2 -0
  120. data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -0
  121. data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +2 -0
  122. data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +2 -0
  123. data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +2 -0
  124. data/spec/mysql/text_blob_types/text_blob_types_spec.rb +2 -0
  125. data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +2 -0
  126. data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +2 -0
  127. data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +2 -0
  128. data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +2 -0
  129. data/spec/mysql57/json/add_json_column_spec.rb +2 -0
  130. data/spec/mysql57/json/change_json_column_spec.rb +2 -0
  131. data/spec/mysql57/json/drop_json_column_spec.rb +2 -0
  132. data/spec/mysql57/virtual/add_virtual_column_spec.rb +2 -0
  133. data/spec/mysql57/virtual/change_virtual_column_spec.rb +2 -0
  134. data/spec/mysql57/virtual/drop_virtual_column_spec.rb +2 -0
  135. data/spec/postgresql/diff/diff_spec.rb +2 -0
  136. data/spec/postgresql/dump/dump_spec.rb +2 -0
  137. data/spec/postgresql/fk/migrate_change_fk_spec.rb +2 -0
  138. data/spec/postgresql/fk/migrate_create_fk_spec.rb +2 -0
  139. data/spec/postgresql/fk/migrate_drop_fk_spec.rb +2 -0
  140. data/spec/postgresql/migrate/migrate_add_column_spec.rb +2 -0
  141. data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -0
  142. data/spec/postgresql/migrate/migrate_bigint_spec.rb +2 -0
  143. data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +2 -0
  144. data/spec/postgresql/migrate/migrate_change_column_spec.rb +2 -0
  145. data/spec/postgresql/migrate/migrate_change_index_spec.rb +2 -0
  146. data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +2 -0
  147. data/spec/postgresql/migrate/migrate_create_table_spec.rb +2 -0
  148. data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +2 -0
  149. data/spec/postgresql/migrate/migrate_drop_column_spec.rb +2 -0
  150. data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +2 -0
  151. data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +2 -0
  152. data/spec/postgresql/migrate/migrate_drop_index_spec.rb +2 -0
  153. data/spec/postgresql/migrate/migrate_drop_table_spec.rb +2 -0
  154. data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +2 -0
  155. data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +2 -0
  156. data/spec/postgresql/migrate/migrate_primary_key_spec.rb +2 -0
  157. data/spec/postgresql/migrate/migrate_references_spec.rb +2 -0
  158. data/spec/postgresql/migrate/migrate_rename_column_spec.rb +2 -0
  159. data/spec/postgresql/migrate/migrate_rename_table_spec.rb +2 -0
  160. data/spec/postgresql/migrate/migrate_same_spec.rb +2 -0
  161. data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +2 -0
  162. data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +2 -0
  163. data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +2 -0
  164. data/spec/processing_for_travis.rb +2 -0
  165. data/spec/spec_condition.rb +2 -0
  166. data/spec/spec_const.rb +9 -7
  167. data/spec/spec_helper.rb +2 -0
  168. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51752811fa355ec8328988d3f2b78f5eaa972379763e56498d7a9d8130e72b7c
4
- data.tar.gz: 0e7dc4410a0c90fadc8c49d17292f947dfb14740cd89556e00420712a667ee79
3
+ metadata.gz: c2104cf0ea5eb17266081c4b2db6c7b390a3ebc4df734ccb898eb1478bb7c0ed
4
+ data.tar.gz: 702816a704bc72068d180d727ed553e3c76f7544db369d2cd589edc26bdd2afd
5
5
  SHA512:
6
- metadata.gz: cec836a87f959d8ded39667c3e726c9c11756fa20a03e75d9082cb5e7325ecb75aa6e4faf4660ad08615d333e50f8799157228b60fed4f176480656e9b0c9d46
7
- data.tar.gz: e1dd85e686cf7ebf3bee192e2ac26f1f533f935a9e0c286ab6717badd288572325fe6dca5fb8393d94d8c138407a5ca4718480274cd6c4d618ffe01b411ea196
6
+ metadata.gz: e04195925c916ae4c402ff82101eb27d1ee1f6e0018e1a74907257e0b6039bfd3026f4e022a14b64b884c4f22528b7292a3c9bb03ec838605467829dcfa54ce1
7
+ data.tar.gz: d5224c934575112e67f0932d18ec9167923f93a18d4d96924c29462576754f56c8198e4e6a19171b0bc9ddb4b5e1d849fabaff4c6b7852f32876c0f1bba08896
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --colour
1
+ --color
2
2
  --require spec_helper
3
3
  --format HidePendingFormatter
data/.rubocop.yml CHANGED
@@ -2,7 +2,7 @@ AllCops:
2
2
  Exclude:
3
3
  - 'gemfiles/**/*'
4
4
  - 'omnibus-ridgepole/**/*'
5
- TargetRubyVersion: 2.2
5
+ TargetRubyVersion: 2.4
6
6
  Bundler/OrderedGems:
7
7
  Include:
8
8
  - 'Appraisals'
@@ -39,3 +39,5 @@ Style/TrailingCommaInHashLiteral:
39
39
  EnforcedStyleForMultiline: consistent_comma
40
40
  Layout/ClosingHeredocIndentation:
41
41
  Enabled: false
42
+ Style/NumericPredicate:
43
+ Enabled: false
data/.travis.yml CHANGED
@@ -6,10 +6,9 @@ cache:
6
6
  - bundler
7
7
  - apt
8
8
  rvm:
9
- - 2.3.8
10
- - 2.4.5
11
- - 2.5.3
12
- - 2.6.0
9
+ - 2.4.6
10
+ - 2.5.5
11
+ - 2.6.3
13
12
  before_script:
14
13
  - sudo service mysql stop
15
14
  - sudo service postgresql stop
@@ -44,5 +43,5 @@ matrix:
44
43
  exclude:
45
44
  - rvm: 2.3.8
46
45
  gemfile: gemfiles/activerecord_6.0.gemfile
47
- - rvm: 2.4.5
46
+ - rvm: 2.4.6
48
47
  gemfile: gemfiles/activerecord_6.0.gemfile
data/Appraisals CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  appraise 'activerecord-5.0' do
2
4
  gem 'activerecord', '~> 5.0.1'
3
5
  gem 'pg', '< 1.0.0'
@@ -13,5 +15,5 @@ appraise 'activerecord-5.2' do
13
15
  end
14
16
 
15
17
  appraise 'activerecord-6.0' do
16
- gem 'activerecord', '~> 6.0.0.rc1'
18
+ gem 'activerecord', '~> 6.0.0.rc2'
17
19
  end
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in ridgepole.gemspec
data/README.md CHANGED
@@ -5,9 +5,8 @@ Ridgepole is a tool to manage DB schema.
5
5
  It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.html#types-of-schema-dumps), and updates DB schema according to DSL.
6
6
  (like Chef/Puppet)
7
7
 
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.7.5.beta2-green.svg?longCache=true&style=flat)](https://rubygems.org/gems/ridgepole/versions/0.7.5.beta2)
10
- -->
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.8.0.rc2-green.svg?longCache=true&style=flat)](https://rubygems.org/gems/ridgepole/versions/0.8.0.rc2)
11
10
  [![Build Status](https://travis-ci.org/winebarrel/ridgepole.svg?branch=0.7)](https://travis-ci.org/winebarrel/ridgepole)
12
11
  [![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.7)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.7)
13
12
 
@@ -99,6 +98,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
99
98
  * Add ignore option ([pull#267](https://github.com/winebarrel/ridgepole/pull/267))
100
99
  * `>= 0.7.7`
101
100
  * Support URI query string ([pull#273](https://github.com/winebarrel/ridgepole/pull/273))
101
+ * `>= 0.7.8`
102
+ * Fix for `add_foreign_key(..., column: ,,,)` ([pull#278](https://github.com/winebarrel/ridgepole/pull/278))
102
103
  </details>
103
104
 
104
105
  ## Installation
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
  require 'rspec/core/rake_task'
3
5
  require 'rubocop/rake_task'
data/bin/ridgepole CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
2
4
  $LOAD_PATH << File.expand_path('../lib', __dir__)
3
5
  require 'yaml'
4
6
  require 'optparse'
@@ -10,9 +12,9 @@ $stdout.sync = true
10
12
  $stderr.sync = true
11
13
 
12
14
  Version = Ridgepole::VERSION
13
- DEFAULT_FILENAME = 'Schemafile'.freeze
15
+ DEFAULT_FILENAME = 'Schemafile'
14
16
 
15
- MAGIC_COMMENT = <<-RUBY.freeze
17
+ MAGIC_COMMENT = <<-RUBY
16
18
  # -*- mode: ruby -*-
17
19
  # vi: set ft=ruby :
18
20
  RUBY
@@ -2,6 +2,6 @@
2
2
 
3
3
  source "https://rubygems.org"
4
4
 
5
- gem "activerecord", "~> 6.0.0.rc1"
5
+ gem "activerecord", "~> 6.0.0.rc2"
6
6
 
7
7
  gemspec path: "../"
data/lib/ridgepole.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'logger'
2
4
  require 'open3'
3
5
  require 'pp'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'erb'
2
4
  require 'yaml'
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class Client
3
5
  def initialize(conn_spec, options = {})
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class ConnectionAdapters
3
5
  def self.mysql?
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class DefaultsLimit
3
5
  DEFAULTS_LIMITS = {
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class Delta
3
- SCRIPT_NAME = '<Schema>'.freeze
5
+ SCRIPT_NAME = '<Schema>'
4
6
 
5
7
  def initialize(delta, options = {})
6
8
  @delta = delta
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class Diff
3
5
  PRIMARY_KEY_OPTIONS = %i[id limit default null precision scale collation unsigned].freeze
@@ -349,9 +351,9 @@ module Ridgepole
349
351
  end
350
352
 
351
353
  def target?(table_name)
352
- if @options[:tables] && @options[:tables].include?(table_name)
354
+ if @options[:tables]&.include?(table_name)
353
355
  true
354
- elsif @options[:ignore_tables] && @options[:ignore_tables].any? { |i| i =~ table_name }
356
+ elsif @options[:ignore_tables]&.any? { |i| i =~ table_name }
355
357
  false
356
358
  elsif @options[:tables]
357
359
  false
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class DSLParser
3
5
  def initialize(options = {})
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class DSLParser
3
5
  class Context
@@ -26,7 +28,7 @@ module Ridgepole
26
28
  table_name = table_name.to_s
27
29
  table_definition = TableDefinition.new(table_name, self)
28
30
 
29
- options[:primary_key] = options[:primary_key].to_s if options[:primary_key] && options[:primary_key].is_a?(Symbol)
31
+ options[:primary_key] = options[:primary_key].to_s if options[:primary_key]&.is_a?(Symbol)
30
32
  if options[:id] && TableDefinition::ALIAS_TYPES.key?(options[:id])
31
33
  type, type_default_opts = TableDefinition::ALIAS_TYPES[options[:id]]
32
34
  options[:id] = type
@@ -80,7 +82,7 @@ module Ridgepole
80
82
  options[:column] = options[:column].to_s if options[:column]
81
83
  @__definition[from_table] ||= {}
82
84
  @__definition[from_table][:foreign_keys] ||= {}
83
- idx = options[:name] || [from_table, to_table]
85
+ idx = options[:name] || [from_table, to_table, options[:column]]
84
86
 
85
87
  raise "Foreign Key `#{from_table}(#{idx})` already defined" if @__definition[from_table][:foreign_keys][idx]
86
88
 
@@ -91,7 +93,7 @@ module Ridgepole
91
93
  end
92
94
 
93
95
  def require(file)
94
- schemafile = file =~ %r{\A/} ? file : File.join(@__working_dir, file)
96
+ schemafile = %r{\A/}.match?(file) ? file : File.join(@__working_dir, file)
95
97
 
96
98
  if File.exist?(schemafile)
97
99
  instance_eval(File.read(schemafile), schemafile)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class DSLParser
3
5
  class TableDefinition
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class Dumper
3
5
  def initialize(options = {})
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class ExecuteExpander
3
5
  class Stub
@@ -18,7 +20,7 @@ module Ridgepole
18
20
  callback.call(sql, name)
19
21
  end
20
22
 
21
- if sql =~ /\A(SELECT|SHOW)\b/i
23
+ if /\A(SELECT|SHOW)\b/i.match?(sql)
22
24
  begin
23
25
  super(sql, name)
24
26
  rescue StandardError
@@ -28,7 +30,7 @@ module Ridgepole
28
30
  Stub.new
29
31
  end
30
32
  elsif Ridgepole::ExecuteExpander.use_script
31
- if sql =~ /\A(SELECT|SHOW)\b/i
33
+ if /\A(SELECT|SHOW)\b/i.match?(sql)
32
34
  super(sql, name)
33
35
  else
34
36
  sql = append_alter_extra(sql)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/connection_adapters/abstract_adapter'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/connection_adapters/abstract_mysql_adapter'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/connection_adapters/abstract_mysql_adapter'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  module Ext
3
5
  module PpSortHash
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/schema_dumper'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class ExternalSqlExecuter
3
5
  def initialize(script, logger)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
4
  class Logger < ::Logger
3
5
  include Singleton
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/migration'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/schema_dumper'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_record/connection_adapters/abstract/schema_statements'
2
4
 
3
5
  module Ridgepole
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Ridgepole
2
- VERSION = '0.8.0.rc1'.freeze
4
+ VERSION = '0.8.0.rc2'
3
5
  end
data/ridgepole.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
  require 'ridgepole/version'
data/spec/cli_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module CLIHelper
2
4
  def default_cli_hook
3
5
  <<-RUBY.strip_heredoc
data/spec/erb_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  include ERBh
2
4
 
3
5
  ERBh.define_method(:i) do |obj|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HidePendingFormatter < RSpec::Core::Formatters::ProgressFormatter
2
4
  RSpec::Core::Formatters.register self, :example_pending
3
5
  RSpec::Core::Formatters.register self, :dump_pending
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client#diff -> migrate' do
2
4
  context 'when change mysql table options' do
3
5
  let(:actual_dsl) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client (with bigint pk)', condition: 5.0 do
2
4
  let(:id_primary_key_create_table) do
3
5
  <<-RUBY
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client (with integer pk)', condition: '>= 5.1.0' do
2
4
  context 'when with id:integer' do
3
5
  let(:dsl) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe Ridgepole::Config do
2
4
  subject { Ridgepole::Config.load(config, env) }
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'ridgepole' do
2
4
  let(:differ) { false }
3
5
  let(:conf) { "'" + JSON.dump(conn_spec) + "'" }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client#diff -> migrate' do
2
4
  context 'when change column (add collation)' do
3
5
  let(:actual_dsl) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client#diff -> migrate' do
2
4
  context 'when change column (add comment)' do
3
5
  let(:actual_dsl) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  describe 'Ridgepole::Client (use default:lambda)' do
2
4
  context 'when create table with default:lambda' do
3
5
  subject { client }