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.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.rubocop.yml +3 -1
- data/.travis.yml +4 -5
- data/Appraisals +3 -1
- data/Gemfile +2 -0
- data/README.md +4 -3
- data/Rakefile +2 -0
- data/bin/ridgepole +4 -2
- data/gemfiles/activerecord_6.0.gemfile +1 -1
- data/lib/ridgepole.rb +2 -0
- data/lib/ridgepole/cli/config.rb +2 -0
- data/lib/ridgepole/client.rb +2 -0
- data/lib/ridgepole/connection_adapters.rb +2 -0
- data/lib/ridgepole/default_limit.rb +2 -0
- data/lib/ridgepole/delta.rb +3 -1
- data/lib/ridgepole/diff.rb +4 -2
- data/lib/ridgepole/dsl_parser.rb +2 -0
- data/lib/ridgepole/dsl_parser/context.rb +5 -3
- data/lib/ridgepole/dsl_parser/table_definition.rb +2 -0
- data/lib/ridgepole/dumper.rb +2 -0
- data/lib/ridgepole/execute_expander.rb +4 -2
- data/lib/ridgepole/ext/abstract_adapter/disable_table_options.rb +2 -0
- data/lib/ridgepole/ext/abstract_mysql_adapter/dump_auto_increment.rb +2 -0
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +2 -0
- data/lib/ridgepole/ext/pp_sort_hash.rb +2 -0
- data/lib/ridgepole/ext/schema_dumper.rb +2 -0
- data/lib/ridgepole/external_sql_executer.rb +2 -0
- data/lib/ridgepole/logger.rb +2 -0
- data/lib/ridgepole/migration_ext.rb +2 -0
- data/lib/ridgepole/schema_dumper_ext.rb +2 -0
- data/lib/ridgepole/schema_statements_ext.rb +2 -0
- data/lib/ridgepole/version.rb +3 -1
- data/ridgepole.gemspec +2 -0
- data/spec/cli_helper.rb +2 -0
- data/spec/erb_helper.rb +2 -0
- data/spec/hide_pending_formatter.rb +2 -0
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +2 -0
- data/spec/mysql/bigint_pk/bigint_pk_spec.rb +2 -0
- data/spec/mysql/bigint_pk/int_pk_spec.rb +2 -0
- data/spec/mysql/cli/config_spec.rb +2 -0
- data/spec/mysql/cli/ridgepole_spec.rb +2 -0
- data/spec/mysql/collation/collation_spec.rb +2 -0
- data/spec/mysql/comment/comment_spec.rb +2 -0
- data/spec/mysql/default_lambda/default_lambda_spec.rb +2 -0
- data/spec/mysql/diff/diff2_spec.rb +2 -0
- data/spec/mysql/diff/diff_spec.rb +2 -0
- data/spec/mysql/dump/dump_class_method_spec.rb +6 -0
- data/spec/mysql/dump/dump_some_tables_spec.rb +10 -0
- data/spec/mysql/dump/dump_spec.rb +6 -0
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +2 -0
- data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -0
- data/spec/mysql/fk/migrate_change_fk2_spec.rb +2 -0
- data/spec/mysql/fk/migrate_change_fk_spec.rb +2 -0
- data/spec/mysql/fk/migrate_create_fk_spec.rb +2 -0
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +2 -0
- data/spec/mysql/fk/migrate_fk_with_column_spec.rb +163 -0
- data/spec/mysql/fk/migrate_ignore_fk_spec.rb +2 -0
- data/spec/mysql/migrate/check_orphan_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_add_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column4_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column7_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column8_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column_float_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_table_comment_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_table_with_ignore_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_table_with_options_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_duplicate_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_duplicate_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_empty_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_execute_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_ignore_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_ignore_index_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_log_file_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_noop_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_same_default_null_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_same_spec.rb +6 -0
- data/spec/mysql/migrate/migrate_script_error_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_skip_column_comment_change_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -0
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +2 -0
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +2 -0
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +2 -0
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +2 -0
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +2 -0
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +2 -0
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +2 -0
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +2 -0
- data/spec/mysql57/json/add_json_column_spec.rb +2 -0
- data/spec/mysql57/json/change_json_column_spec.rb +2 -0
- data/spec/mysql57/json/drop_json_column_spec.rb +2 -0
- data/spec/mysql57/virtual/add_virtual_column_spec.rb +2 -0
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +2 -0
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +2 -0
- data/spec/postgresql/diff/diff_spec.rb +2 -0
- data/spec/postgresql/dump/dump_spec.rb +2 -0
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +2 -0
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +2 -0
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_add_expression_index_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_drop_expression_index_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_primary_key2_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_primary_key_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_references_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +2 -0
- data/spec/postgresql/migrate/migrate_same_spec.rb +2 -0
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +2 -0
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +2 -0
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +2 -0
- data/spec/processing_for_travis.rb +2 -0
- data/spec/spec_condition.rb +2 -0
- data/spec/spec_const.rb +9 -7
- data/spec/spec_helper.rb +2 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2104cf0ea5eb17266081c4b2db6c7b390a3ebc4df734ccb898eb1478bb7c0ed
|
4
|
+
data.tar.gz: 702816a704bc72068d180d727ed553e3c76f7544db369d2cd589edc26bdd2afd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e04195925c916ae4c402ff82101eb27d1ee1f6e0018e1a74907257e0b6039bfd3026f4e022a14b64b884c4f22528b7292a3c9bb03ec838605467829dcfa54ce1
|
7
|
+
data.tar.gz: d5224c934575112e67f0932d18ec9167923f93a18d4d96924c29462576754f56c8198e4e6a19171b0bc9ddb4b5e1d849fabaff4c6b7852f32876c0f1bba08896
|
data/.rspec
CHANGED
data/.rubocop.yml
CHANGED
@@ -2,7 +2,7 @@ AllCops:
|
|
2
2
|
Exclude:
|
3
3
|
- 'gemfiles/**/*'
|
4
4
|
- 'omnibus-ridgepole/**/*'
|
5
|
-
TargetRubyVersion: 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.
|
10
|
-
- 2.
|
11
|
-
- 2.
|
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.
|
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.
|
18
|
+
gem 'activerecord', '~> 6.0.0.rc2'
|
17
19
|
end
|
data/Gemfile
CHANGED
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.
|
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
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'
|
15
|
+
DEFAULT_FILENAME = 'Schemafile'
|
14
16
|
|
15
|
-
MAGIC_COMMENT = <<-RUBY
|
17
|
+
MAGIC_COMMENT = <<-RUBY
|
16
18
|
# -*- mode: ruby -*-
|
17
19
|
# vi: set ft=ruby :
|
18
20
|
RUBY
|
data/lib/ridgepole.rb
CHANGED
data/lib/ridgepole/cli/config.rb
CHANGED
data/lib/ridgepole/client.rb
CHANGED
data/lib/ridgepole/delta.rb
CHANGED
data/lib/ridgepole/diff.rb
CHANGED
@@ -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]
|
354
|
+
if @options[:tables]&.include?(table_name)
|
353
355
|
true
|
354
|
-
elsif @options[:ignore_tables]
|
356
|
+
elsif @options[:ignore_tables]&.any? { |i| i =~ table_name }
|
355
357
|
false
|
356
358
|
elsif @options[:tables]
|
357
359
|
false
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -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]
|
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 =
|
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)
|
data/lib/ridgepole/dumper.rb
CHANGED
@@ -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
|
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
|
33
|
+
if /\A(SELECT|SHOW)\b/i.match?(sql)
|
32
34
|
super(sql, name)
|
33
35
|
else
|
34
36
|
sql = append_alter_extra(sql)
|
data/lib/ridgepole/logger.rb
CHANGED
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
data/spec/cli_helper.rb
CHANGED
data/spec/erb_helper.rb
CHANGED