ridgepole 0.8.8 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +63 -0
- data/.rubocop.yml +11 -36
- data/README.md +13 -1
- data/lib/ridgepole/default_limit.rb +1 -1
- data/lib/ridgepole/diff.rb +12 -0
- data/lib/ridgepole/dsl_parser.rb +3 -4
- data/lib/ridgepole/dsl_parser/context.rb +1 -1
- data/lib/ridgepole/dsl_parser/table_definition.rb +51 -41
- data/lib/ridgepole/ext/abstract_mysql_adapter/use_alter_index.rb +1 -1
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +4 -2
- data/spec/erb_helper.rb +4 -4
- data/spec/mysql/collation/collation_spec.rb +1 -1
- data/spec/mysql/fk/migrate_create_fk_spec.rb +77 -8
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +109 -18
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +4 -1
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +11 -4
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -0
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +11 -4
- data/spec/spec_condition.rb +4 -0
- data/spec/spec_helper.rb +2 -1
- metadata +37 -9
- data/.travis.yml +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c68b630030e34fb6e399e053d7d5c43245487c81d0869f9783b05e1135b5e2e
|
4
|
+
data.tar.gz: b7061e1c9c0bdf8e7509ab3601e397031edd2d9397975b178bac12ddb669c413
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bbfcabaad944ad5ed18c5b809e06243582c9f3977890e499c2b400af7f268206876174d0cd3b6184e67b33ef67d5bd6226b63c88c13d820c9ed4fab5f5bdbdc
|
7
|
+
data.tar.gz: 7ed62d44a593d40b8c3d8b91b6d0ea7c10ae99337789db4ffbdffc9bf43cfb6b2e2fc81959cca1e823a9adf40968717d264f965aa4edb4e591bed55cff3c7c9d
|
@@ -0,0 +1,63 @@
|
|
1
|
+
name: test
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
pull_request:
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
fail-fast: false
|
12
|
+
matrix:
|
13
|
+
ruby:
|
14
|
+
- 2.4
|
15
|
+
- 2.5
|
16
|
+
- 2.6
|
17
|
+
- 2.7
|
18
|
+
env:
|
19
|
+
- MYSQL56=1
|
20
|
+
- MYSQL57=1
|
21
|
+
- POSTGRESQL=1
|
22
|
+
gemfile:
|
23
|
+
- gemfiles/activerecord_5.0.gemfile
|
24
|
+
- gemfiles/activerecord_5.1.gemfile
|
25
|
+
- gemfiles/activerecord_5.2.gemfile
|
26
|
+
- gemfiles/activerecord_6.0.gemfile
|
27
|
+
exclude:
|
28
|
+
- ruby: 2.4
|
29
|
+
gemfile: gemfiles/activerecord_6.0.gemfile
|
30
|
+
|
31
|
+
steps:
|
32
|
+
- uses: actions/checkout@v2
|
33
|
+
- uses: actions/setup-ruby@v1
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
- uses: actions/cache@v2
|
37
|
+
with:
|
38
|
+
path: gemfiles/vendor/bundle
|
39
|
+
key: ${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ hashFiles('ridgepole.gemspec', '**/Gemfile', '${{ matrix.gemfile }}') }}
|
40
|
+
restore-keys: |
|
41
|
+
${{ runner.os }}-gems-${{ matrix.ruby }}-${{ matrix.gemfile }}-
|
42
|
+
|
43
|
+
- name: Setup dependencies
|
44
|
+
run: |
|
45
|
+
for i in {1..60}; do docker-compose up -d && break; sleep 1; done
|
46
|
+
|
47
|
+
gem install bundler
|
48
|
+
bundle config path vendor/bundle
|
49
|
+
bundle install --jobs 4 --retry 3
|
50
|
+
|
51
|
+
# Wait until database servers start
|
52
|
+
function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P 13316 -ppassword ping; }
|
53
|
+
function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P 13317 -ppassword ping; }
|
54
|
+
function pg_ping { PGPASSWORD=password pg_isready -U postgres -h 127.0.0.1 -p 15442; }
|
55
|
+
for i in {1..60}; do mysql_ping && break; sleep 1; done
|
56
|
+
for i in {1..60}; do mysql57_ping && break; sleep 1; done
|
57
|
+
for i in {1..60}; do pg_ping && break; sleep 1; done
|
58
|
+
env:
|
59
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
60
|
+
|
61
|
+
- run: ${{ matrix.env }} bundle exec rake
|
62
|
+
env:
|
63
|
+
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
data/.rubocop.yml
CHANGED
@@ -3,6 +3,7 @@ AllCops:
|
|
3
3
|
- 'gemfiles/**/*'
|
4
4
|
- 'omnibus-ridgepole/**/*'
|
5
5
|
TargetRubyVersion: 2.4
|
6
|
+
NewCops: enable
|
6
7
|
Bundler/OrderedGems:
|
7
8
|
Include:
|
8
9
|
- 'Appraisals'
|
@@ -30,8 +31,6 @@ Style/Documentation:
|
|
30
31
|
Enabled: false
|
31
32
|
Style/GuardClause:
|
32
33
|
Enabled: false
|
33
|
-
Style/MethodMissingSuper:
|
34
|
-
Enabled: false
|
35
34
|
Style/MixinUsage:
|
36
35
|
Exclude:
|
37
36
|
- 'spec/**/*'
|
@@ -41,37 +40,13 @@ Layout/ClosingHeredocIndentation:
|
|
41
40
|
Enabled: false
|
42
41
|
Style/NumericPredicate:
|
43
42
|
Enabled: false
|
44
|
-
|
45
|
-
Enabled:
|
46
|
-
|
47
|
-
Enabled:
|
48
|
-
|
49
|
-
Enabled:
|
50
|
-
Lint/
|
51
|
-
Enabled:
|
52
|
-
|
53
|
-
Enabled:
|
54
|
-
Lint/StructNewOverride:
|
55
|
-
Enabled: true
|
56
|
-
Style/AccessorGrouping:
|
57
|
-
Enabled: true
|
58
|
-
Style/BisectedAttrAccessor:
|
59
|
-
Enabled: true
|
60
|
-
Style/ExponentialNotation:
|
61
|
-
Enabled: true
|
62
|
-
Style/HashEachMethods:
|
63
|
-
Enabled: true
|
64
|
-
Style/HashTransformKeys:
|
65
|
-
Enabled: true
|
66
|
-
Style/HashTransformValues:
|
67
|
-
Enabled: true
|
68
|
-
Style/RedundantAssignment:
|
69
|
-
Enabled: true
|
70
|
-
Style/RedundantFetchBlock:
|
71
|
-
Enabled: true
|
72
|
-
Style/RedundantRegexpCharacterClass:
|
73
|
-
Enabled: true
|
74
|
-
Style/RedundantRegexpEscape:
|
75
|
-
Enabled: true
|
76
|
-
Style/SlicingWithRange:
|
77
|
-
Enabled: true
|
43
|
+
Lint/MissingSuper:
|
44
|
+
Enabled: false
|
45
|
+
Style/StringConcatenation:
|
46
|
+
Enabled: false
|
47
|
+
Style/SoleNestedConditional:
|
48
|
+
Enabled: false
|
49
|
+
Lint/DuplicateBranch:
|
50
|
+
Enabled: false
|
51
|
+
Style/OptionalBooleanParameter:
|
52
|
+
Enabled: false
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ 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
|
-
[![Build Status](https://
|
9
|
+
[![Build Status](https://github.com/winebarrel/ridgepole/workflows/test/badge.svg?branch=0.8)](https://github.com/winebarrel/ridgepole/actions)
|
10
10
|
[![Coverage Status](https://coveralls.io/repos/github/winebarrel/ridgepole/badge.svg?branch=0.8)](https://coveralls.io/github/winebarrel/ridgepole?branch=0.8)
|
11
11
|
|
12
12
|
<details><summary>ChangeLog</summary>
|
@@ -117,6 +117,18 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
117
117
|
* Support `require_relative` ([pull#298](https://github.com/winebarrel/ridgepole/pull/298))
|
118
118
|
* `>= 0.8.8`
|
119
119
|
* Fix keyword arguments warnings in Ruby 2.7 ([pull#303](https://github.com/winebarrel/ridgepole/pull/303))
|
120
|
+
* `>= 0.8.9`
|
121
|
+
* Fix unexpected differences on text types and blob types on Rails 6 ([pull#306](https://github.com/winebarrel/ridgepole/pull/306))
|
122
|
+
* Fix unexpected warning when a foreign key is added on the primary key ([pull#307](https://github.com/winebarrel/ridgepole/pull/307))
|
123
|
+
* `>= 0.8.10`
|
124
|
+
* Raise an error if an InnoDB column has a foreign key but no index ([pull#310](https://github.com/winebarrel/ridgepole/pull/310))
|
125
|
+
* `>= 0.8.11`
|
126
|
+
* Fix FK index check support multiple PK ([pull#315](https://github.com/winebarrel/ridgepole/pull/315))
|
127
|
+
* Support t.reference() foreign_key option ([pull#316](https://github.com/winebarrel/ridgepole/pull/316))
|
128
|
+
* `>= 0.8.12`
|
129
|
+
* Pluralize column specified by `references` ([pull#317](https://github.com/winebarrel/ridgepole/pull/317))
|
130
|
+
* `>= 0.8.13`
|
131
|
+
* Support `serial` and `bigserial` column types ([pull#321](https://github.com/winebarrel/ridgepole/pull/321))
|
120
132
|
</details>
|
121
133
|
|
122
134
|
## Installation
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -386,6 +386,18 @@ module Ridgepole
|
|
386
386
|
attrs[:type] = :bigint
|
387
387
|
opts.delete(:limit)
|
388
388
|
end
|
389
|
+
|
390
|
+
if opts[:size] && (attrs[:type] == :text || attrs[:type] == :blob || attrs[:type] == :binary)
|
391
|
+
case opts.delete(:size)
|
392
|
+
when :tiny
|
393
|
+
attrs[:type] = :blob if attrs[:type] == :binary
|
394
|
+
opts[:limit] = 255
|
395
|
+
when :medium
|
396
|
+
opts[:limit] = 16_777_215
|
397
|
+
when :long
|
398
|
+
opts[:limit] = 4_294_967_295
|
399
|
+
end
|
400
|
+
end
|
389
401
|
end
|
390
402
|
end
|
391
403
|
|
data/lib/ridgepole/dsl_parser.rb
CHANGED
@@ -37,11 +37,10 @@ module Ridgepole
|
|
37
37
|
attrs[:foreign_keys].each do |_, foreign_key_attrs|
|
38
38
|
fk_index = foreign_key_attrs[:options][:column] || "#{foreign_key_attrs[:to_table].singularize}_id"
|
39
39
|
next if attrs[:indices]&.any? { |_k, v| v[:column_name].first == fk_index }
|
40
|
+
# NOTE: For composite primary keys, the first column of the primary key is used as the foreign key index
|
41
|
+
next if Array(attrs[:options][:primary_key]).first == fk_index
|
40
42
|
|
41
|
-
|
42
|
-
[WARNING] Table `#{table_name}` has a foreign key on `#{fk_index}` column, but doesn't have any indexes on the column.
|
43
|
-
Although an index will be added automatically by InnoDB, please add an index explicitly for your future operations.
|
44
|
-
MSG
|
43
|
+
raise "The column `#{fk_index}` of the table `#{table_name}` has a foreign key but no index. Although InnoDB creates an index automatically, please add one explicitly in order for ridgepole to manage it."
|
45
44
|
end
|
46
45
|
end
|
47
46
|
end
|
@@ -27,7 +27,7 @@ module Ridgepole
|
|
27
27
|
table_name = table_name.to_s
|
28
28
|
table_definition = TableDefinition.new(table_name, self)
|
29
29
|
|
30
|
-
options[:primary_key] = options[:primary_key].to_s if options[:primary_key]
|
30
|
+
options[:primary_key] = options[:primary_key].to_s if options[:primary_key].is_a?(Symbol)
|
31
31
|
if options[:id] && TableDefinition::ALIAS_TYPES.key?(options[:id])
|
32
32
|
type, type_default_opts = TableDefinition::ALIAS_TYPES[options[:id]]
|
33
33
|
options[:id] = type
|
@@ -22,57 +22,60 @@ module Ridgepole
|
|
22
22
|
|
23
23
|
DEFAULT_PRIMARY_KEY_TYPE = Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.1') ? :bigint : :integer
|
24
24
|
|
25
|
-
TYPES =
|
25
|
+
TYPES = {
|
26
26
|
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L274
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
27
|
+
string: {},
|
28
|
+
text: {},
|
29
|
+
integer: {},
|
30
|
+
bigint: {},
|
31
|
+
float: {},
|
32
|
+
decimal: {},
|
33
|
+
datetime: {},
|
34
|
+
timestamp: {},
|
35
|
+
time: {},
|
36
|
+
date: {},
|
37
|
+
binary: {},
|
38
|
+
boolean: {},
|
39
39
|
|
40
40
|
# https://github.com/rails/rails/blob/v4.2.1/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L79
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
41
|
+
serial: { null: false },
|
42
|
+
bigserial: { null: false },
|
43
|
+
daterange: {},
|
44
|
+
numrange: {},
|
45
|
+
tsrange: {},
|
46
|
+
tstzrange: {},
|
47
|
+
int4range: {},
|
48
|
+
int8range: {},
|
49
|
+
# binary: {}, # dup key
|
50
|
+
# boolean: {}, # dup key
|
51
|
+
# bigint: {}, # dup key
|
52
|
+
xml: {},
|
53
|
+
tsvector: {},
|
54
|
+
hstore: {},
|
55
|
+
inet: {},
|
56
|
+
cidr: {},
|
57
|
+
macaddr: {},
|
58
|
+
uuid: {},
|
59
|
+
json: {},
|
60
|
+
jsonb: {},
|
61
|
+
ltree: {},
|
62
|
+
citext: {},
|
63
|
+
point: {},
|
64
|
+
bit: {},
|
65
|
+
bit_varying: {},
|
66
|
+
money: {},
|
65
67
|
|
66
68
|
# https://github.com/rails/rails/blob/v5.1.1/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb#L184
|
67
|
-
:
|
69
|
+
virtual: {},
|
68
70
|
|
69
71
|
# https://github.com/rails/rails/blob/v5.0.4/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb#L53
|
70
|
-
:
|
71
|
-
|
72
|
+
# json: {}, # dup key
|
73
|
+
}.freeze
|
72
74
|
|
73
|
-
TYPES.each do |column_type|
|
75
|
+
TYPES.each do |column_type, default_options|
|
74
76
|
define_method column_type do |*args|
|
75
77
|
options = args.extract_options!
|
78
|
+
options = default_options.merge(options)
|
76
79
|
column_names = args
|
77
80
|
column_names.each { |name| column(name, column_type, options) }
|
78
81
|
end
|
@@ -131,6 +134,7 @@ module Ridgepole
|
|
131
134
|
polymorphic_options.merge!(options.slice(:null, :first, :after))
|
132
135
|
index_options = options.key?(:index) ? options.delete(:index) : true
|
133
136
|
type = options.delete(:type) || DEFAULT_PRIMARY_KEY_TYPE
|
137
|
+
foreign_key_options = options.delete(:foreign_key)
|
134
138
|
|
135
139
|
args.each do |col|
|
136
140
|
column("#{col}_id", type, options)
|
@@ -139,6 +143,12 @@ module Ridgepole
|
|
139
143
|
columns = polymorphic ? ["#{col}_type", "#{col}_id"] : ["#{col}_id"]
|
140
144
|
index(columns, index_options.is_a?(Hash) ? index_options : {})
|
141
145
|
end
|
146
|
+
if foreign_key_options # rubocop:disable Style/Next
|
147
|
+
fk_opts = foreign_key_options.is_a?(Hash) ? foreign_key_options.dup : {}
|
148
|
+
fk_opts.update(column: "#{col}_id") if col.to_s.singularize != col.to_s
|
149
|
+
to_table = fk_opts.delete(:to_table) || col.to_s.pluralize
|
150
|
+
@base.add_foreign_key(@table_name, to_table, fk_opts)
|
151
|
+
end
|
142
152
|
end
|
143
153
|
end
|
144
154
|
alias belongs_to references
|
@@ -7,7 +7,7 @@ module Ridgepole
|
|
7
7
|
module AbstractMysqlAdapter
|
8
8
|
module UseAlterIndex
|
9
9
|
def add_index(table_name, column_name, options = {})
|
10
|
-
index_name, index_type, index_columns, index_options, _index_algorithm, index_using = add_index_options(table_name, column_name, options)
|
10
|
+
index_name, index_type, index_columns, index_options, _index_algorithm, index_using = add_index_options(table_name, column_name, **options)
|
11
11
|
|
12
12
|
# cannot specify index_algorithm
|
13
13
|
execute "ALTER TABLE #{quote_table_name(table_name)} ADD #{index_type} INDEX #{quote_column_name(index_name)} #{index_using} (#{index_columns})#{index_options}"
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.2.7')
|
22
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.2.7') # rubocop:disable Gemspec/RequiredRubyVersion
|
23
23
|
|
24
24
|
spec.add_dependency 'activerecord', '>= 5.0.1', '< 6.1'
|
25
25
|
spec.add_dependency 'diffy'
|
@@ -36,5 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'rspec', '>= 3.0.0'
|
37
37
|
spec.add_development_dependency 'rspec-match_fuzzy', '>= 0.1.3'
|
38
38
|
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
|
39
|
-
spec.add_development_dependency 'rubocop', '>=
|
39
|
+
spec.add_development_dependency 'rubocop', '>= 1.7.0'
|
40
|
+
spec.add_development_dependency 'rubocop-rake', '>= 0.5.1'
|
41
|
+
spec.add_development_dependency 'rubocop-rspec', '>= 2.1.0'
|
40
42
|
end
|
data/spec/erb_helper.rb
CHANGED
@@ -141,7 +141,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
141
141
|
# v6.0.3 is the oldest version that doesn't produce any kwargs warnings with Ruby 2.7
|
142
142
|
if condition('< 6.0.3')
|
143
143
|
# https://github.com/jeremyevans/ruby-warning/blob/1.1.0/lib/warning.rb#L18
|
144
|
-
out = out.lines.grep_v(/: warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z/).join
|
144
|
+
out = out.lines.grep_v(/: warning: (?:Using the last argument (?:for `.+' )?as keyword parameters is deprecated; maybe \*\* should be added to the call|Passing the keyword argument (?:for `.+' )?as the last hash parameter is deprecated|Splitting the last argument (?:for `.+' )?into positional and keyword parameters is deprecated|The called method (?:`.+' )?is defined here)\n\z/).join
|
145
145
|
end
|
146
146
|
|
147
147
|
expect(out).to be_empty
|
@@ -186,15 +186,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
186
186
|
subject { client(dump_without_table_options: false) }
|
187
187
|
|
188
188
|
it {
|
189
|
-
expect(Ridgepole::Logger.instance).to receive(:warn).with(<<-MSG).twice
|
190
|
-
[WARNING] Table `child` has a foreign key on `parent_id` column, but doesn't have any indexes on the column.
|
191
|
-
Although an index will be added automatically by InnoDB, please add an index explicitly for your future operations.
|
192
|
-
MSG
|
193
|
-
subject.diff(dsl).migrate
|
194
|
-
|
195
189
|
expect do
|
196
190
|
subject.diff(dsl).migrate
|
197
|
-
end.to raise_error(
|
191
|
+
end.to raise_error('The column `parent_id` of the table `child` has a foreign key but no index. Although InnoDB creates an index automatically, please add one explicitly in order for ridgepole to manage it.')
|
198
192
|
}
|
199
193
|
end
|
200
194
|
|
@@ -219,7 +213,82 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
219
213
|
expect(Ridgepole::Logger.instance).to_not receive(:warn)
|
220
214
|
subject.diff(dsl).migrate
|
221
215
|
|
222
|
-
expect
|
216
|
+
expect(subject.diff(dsl).differ?).to be_falsey
|
223
217
|
}
|
224
218
|
end
|
219
|
+
|
220
|
+
context 'when create fk on the primary key' do
|
221
|
+
let(:dsl) do
|
222
|
+
erbh(<<-ERB)
|
223
|
+
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
224
|
+
end
|
225
|
+
|
226
|
+
create_table "icons", primary_key: "user_id", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
227
|
+
end
|
228
|
+
add_foreign_key "icons", "users", name: "fk_icons_users"
|
229
|
+
ERB
|
230
|
+
end
|
231
|
+
|
232
|
+
subject { client(dump_without_table_options: false) }
|
233
|
+
|
234
|
+
it {
|
235
|
+
expect(Ridgepole::Logger.instance).to_not receive(:warn)
|
236
|
+
subject.diff(dsl).migrate
|
237
|
+
|
238
|
+
expect(subject.diff(dsl).differ?).to be_falsey
|
239
|
+
}
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
context 'when create fk on the first primary key' do
|
244
|
+
let(:dsl) do
|
245
|
+
erbh(<<-ERB)
|
246
|
+
create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
247
|
+
end
|
248
|
+
|
249
|
+
create_table "employee", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
250
|
+
end
|
251
|
+
|
252
|
+
create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
253
|
+
t.integer "user_id", null: false
|
254
|
+
t.integer "employee_id", null: false
|
255
|
+
end
|
256
|
+
add_foreign_key "icons", "users", name: "fk_icons_users"
|
257
|
+
ERB
|
258
|
+
end
|
259
|
+
|
260
|
+
subject { client(dump_without_table_options: false) }
|
261
|
+
|
262
|
+
it {
|
263
|
+
expect(Ridgepole::Logger.instance).to_not receive(:warn)
|
264
|
+
subject.diff(dsl).migrate
|
265
|
+
|
266
|
+
expect(subject.diff(dsl).differ?).to be_falsey
|
267
|
+
}
|
268
|
+
end
|
269
|
+
|
270
|
+
context 'when create fk on the second primary key' do
|
271
|
+
let(:dsl) do
|
272
|
+
erbh(<<-ERB)
|
273
|
+
create_table "users", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
274
|
+
end
|
275
|
+
|
276
|
+
create_table "employee", <%= i cond('>= 5.1',id: :integer) %>, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
277
|
+
end
|
278
|
+
|
279
|
+
create_table "icons", primary_key: ["user_id", "employee_id"], force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
|
280
|
+
t.integer "user_id", null: false
|
281
|
+
t.integer "employee_id", null: false
|
282
|
+
end
|
283
|
+
add_foreign_key "icons", "employees", name: "fk_icons_employees"
|
284
|
+
ERB
|
285
|
+
end
|
286
|
+
|
287
|
+
subject { client(dump_without_table_options: false) }
|
288
|
+
|
289
|
+
it {
|
290
|
+
expect do
|
291
|
+
subject.diff(dsl).migrate
|
292
|
+
end.to raise_error('The column `employee_id` of the table `icons` has a foreign key but no index. Although InnoDB creates an index automatically, please add one explicitly in order for ridgepole to manage it.')
|
293
|
+
}
|
225
294
|
end
|
@@ -99,9 +99,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
99
99
|
t.string "last_name", limit: 16, null: false
|
100
100
|
t.string "gender", limit: 1, null: false
|
101
101
|
t.date "hire_date", null: false
|
102
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
103
102
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
104
|
-
t.index "products_id"
|
105
103
|
t.index "user_id"
|
106
104
|
end
|
107
105
|
ERB
|
@@ -115,7 +113,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
115
113
|
t.string "last_name", limit: 16, null: false
|
116
114
|
t.string "gender", limit: 1, null: false
|
117
115
|
t.date "hire_date", null: false
|
118
|
-
t.references :
|
116
|
+
t.references :user
|
119
117
|
end
|
120
118
|
RUBY
|
121
119
|
end
|
@@ -138,11 +136,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
138
136
|
t.string "last_name", limit: 16, null: false
|
139
137
|
t.string "gender", limit: 1, null: false
|
140
138
|
t.date "hire_date", null: false
|
141
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
142
|
-
t.string "products_type"
|
143
139
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
144
140
|
t.string "user_type"
|
145
|
-
t.index ["products_type", "products_id"]
|
146
141
|
t.index ["user_type", "user_id"]
|
147
142
|
end
|
148
143
|
ERB
|
@@ -156,7 +151,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
156
151
|
t.string "last_name", limit: 16, null: false
|
157
152
|
t.string "gender", limit: 1, null: false
|
158
153
|
t.date "hire_date", null: false
|
159
|
-
t.references :
|
154
|
+
t.references :user, polymorphic: true
|
160
155
|
end
|
161
156
|
RUBY
|
162
157
|
end
|
@@ -174,11 +169,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
174
169
|
let(:actual_dsl) do
|
175
170
|
erbh(<<-ERB)
|
176
171
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
177
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id", unsigned: true
|
178
|
-
t.string "products_type"
|
179
172
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id", unsigned: true
|
180
173
|
t.string "user_type"
|
181
|
-
t.index ["products_type", "products_id"]
|
182
174
|
t.index ["user_type", "user_id"]
|
183
175
|
end
|
184
176
|
ERB
|
@@ -187,7 +179,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
187
179
|
let(:expected_dsl) do
|
188
180
|
<<-RUBY
|
189
181
|
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
190
|
-
t.references :
|
182
|
+
t.references :user, unsigned: true, polymorphic: true
|
191
183
|
end
|
192
184
|
RUBY
|
193
185
|
end
|
@@ -222,7 +214,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
222
214
|
t.string "last_name", limit: 16, null: false
|
223
215
|
t.string "gender", limit: 1, null: false
|
224
216
|
t.date "hire_date", null: false
|
225
|
-
t.references :
|
217
|
+
t.references :user
|
226
218
|
end
|
227
219
|
RUBY
|
228
220
|
end
|
@@ -235,9 +227,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
235
227
|
t.string "last_name", limit: 16, null: false
|
236
228
|
t.string "gender", limit: 1, null: false
|
237
229
|
t.date "hire_date", null: false
|
238
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
239
230
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
240
|
-
t.index ["products_id"], name: "index_employees_on_products_id", <%= i cond(5.0, using: :btree) %>
|
241
231
|
t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
|
242
232
|
end
|
243
233
|
ERB
|
@@ -276,7 +266,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
276
266
|
t.string "last_name", limit: 16, null: false
|
277
267
|
t.string "gender", limit: 1, null: false
|
278
268
|
t.date "hire_date", null: false
|
279
|
-
t.references :
|
269
|
+
t.references :user, polymorphic: true
|
280
270
|
end
|
281
271
|
RUBY
|
282
272
|
end
|
@@ -289,11 +279,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
289
279
|
t.string "last_name", limit: 16, null: false
|
290
280
|
t.string "gender", limit: 1, null: false
|
291
281
|
t.date "hire_date", null: false
|
292
|
-
t.<%= cond('>= 5.1','bigint', 'integer') %> "products_id"
|
293
|
-
t.string "products_type"
|
294
282
|
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
295
283
|
t.string "user_type"
|
296
|
-
t.index ["products_type", "products_id"], name: "index_employees_on_products_type_and_products_id", <%= i cond(5.0, using: :btree) %>
|
297
284
|
t.index ["user_type", "user_id"], name: "index_employees_on_user_type_and_user_id", <%= i cond(5.0, using: :btree) %>
|
298
285
|
end
|
299
286
|
ERB
|
@@ -310,4 +297,108 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
310
297
|
expect(subject.dump).to match_ruby expected_dsl
|
311
298
|
}
|
312
299
|
end
|
300
|
+
|
301
|
+
context 'when use references with fk (no change)' do
|
302
|
+
let(:actual_dsl) do
|
303
|
+
erbh(<<-ERB)
|
304
|
+
create_table "users", force: :cascade do |t|
|
305
|
+
end
|
306
|
+
|
307
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
308
|
+
t.date "birth_date", null: false
|
309
|
+
t.string "first_name", limit: 14, null: false
|
310
|
+
t.string "last_name", limit: 16, null: false
|
311
|
+
t.string "gender", limit: 1, null: false
|
312
|
+
t.date "hire_date", null: false
|
313
|
+
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
314
|
+
t.index "user_id"
|
315
|
+
end
|
316
|
+
|
317
|
+
add_foreign_key("employees", "users")
|
318
|
+
ERB
|
319
|
+
end
|
320
|
+
|
321
|
+
let(:expected_dsl) do
|
322
|
+
erbh(<<-ERB)
|
323
|
+
create_table "users", force: :cascade do |t|
|
324
|
+
end
|
325
|
+
|
326
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
327
|
+
t.date "birth_date", null: false
|
328
|
+
t.string "first_name", limit: 14, null: false
|
329
|
+
t.string "last_name", limit: 16, null: false
|
330
|
+
t.string "gender", limit: 1, null: false
|
331
|
+
t.date "hire_date", null: false
|
332
|
+
t.references :user, foreign_key: true
|
333
|
+
end
|
334
|
+
ERB
|
335
|
+
end
|
336
|
+
|
337
|
+
before { subject.diff(actual_dsl).migrate }
|
338
|
+
subject { client }
|
339
|
+
|
340
|
+
it {
|
341
|
+
delta = subject.diff(expected_dsl)
|
342
|
+
expect(delta.differ?).to be_falsey
|
343
|
+
}
|
344
|
+
end
|
345
|
+
|
346
|
+
context 'when use references with fk (change)' do
|
347
|
+
let(:actual_dsl) do
|
348
|
+
erbh(<<-ERB)
|
349
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
350
|
+
t.date "birth_date", null: false
|
351
|
+
t.string "first_name", limit: 14, null: false
|
352
|
+
t.string "last_name", limit: 16, null: false
|
353
|
+
t.string "gender", limit: 1, null: false
|
354
|
+
t.date "hire_date", null: false
|
355
|
+
end
|
356
|
+
create_table "users", force: :cascade do |t|
|
357
|
+
end
|
358
|
+
ERB
|
359
|
+
end
|
360
|
+
|
361
|
+
let(:dsl) do
|
362
|
+
erbh(<<-ERB)
|
363
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
364
|
+
t.date "birth_date", null: false
|
365
|
+
t.string "first_name", limit: 14, null: false
|
366
|
+
t.string "last_name", limit: 16, null: false
|
367
|
+
t.string "gender", limit: 1, null: false
|
368
|
+
t.date "hire_date", null: false
|
369
|
+
t.references :user, foreign_key: true
|
370
|
+
end
|
371
|
+
create_table "users", force: :cascade do |t|
|
372
|
+
end
|
373
|
+
ERB
|
374
|
+
end
|
375
|
+
|
376
|
+
let(:expected_dsl) do
|
377
|
+
erbh(<<-ERB)
|
378
|
+
create_table "employees", primary_key: "emp_no", force: :cascade do |t|
|
379
|
+
t.date "birth_date", null: false
|
380
|
+
t.string "first_name", limit: 14, null: false
|
381
|
+
t.string "last_name", limit: 16, null: false
|
382
|
+
t.string "gender", limit: 1, null: false
|
383
|
+
t.date "hire_date", null: false
|
384
|
+
t.<%= cond('>= 5.1','bigint', 'integer') %> "user_id"
|
385
|
+
t.index ["user_id"], name: "index_employees_on_user_id", <%= i cond(5.0, using: :btree) %>
|
386
|
+
end
|
387
|
+
create_table "users", force: :cascade do |t|
|
388
|
+
end
|
389
|
+
add_foreign_key("employees", "users")
|
390
|
+
ERB
|
391
|
+
end
|
392
|
+
|
393
|
+
before { subject.diff(actual_dsl).migrate }
|
394
|
+
subject { client }
|
395
|
+
|
396
|
+
it {
|
397
|
+
delta = subject.diff(dsl)
|
398
|
+
expect(delta.differ?).to be_truthy
|
399
|
+
expect(subject.dump).to match_ruby actual_dsl
|
400
|
+
delta.migrate
|
401
|
+
expect(subject.dump).to match_ruby expected_dsl
|
402
|
+
}
|
403
|
+
end
|
313
404
|
end
|
@@ -5,7 +5,7 @@ describe 'Ridgepole::Client (with new text/blob types)' do
|
|
5
5
|
subject { client }
|
6
6
|
|
7
7
|
it do
|
8
|
-
|
8
|
+
table_def = <<-RUBY
|
9
9
|
create_table :foos, id: :unsigned_integer do |t|
|
10
10
|
t.blob :blob
|
11
11
|
t.tinyblob :tiny_blob
|
@@ -20,6 +20,7 @@ describe 'Ridgepole::Client (with new text/blob types)' do
|
|
20
20
|
t.unsigned_integer :unsigned_integer
|
21
21
|
end
|
22
22
|
RUBY
|
23
|
+
delta = subject.diff(table_def)
|
23
24
|
|
24
25
|
expect(delta.differ?).to be_truthy
|
25
26
|
delta.migrate
|
@@ -39,6 +40,8 @@ describe 'Ridgepole::Client (with new text/blob types)' do
|
|
39
40
|
t.integer "unsigned_integer", unsigned: true
|
40
41
|
end
|
41
42
|
ERB
|
43
|
+
|
44
|
+
expect(subject.diff(table_def).differ?).to be_falsey
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
@@ -116,10 +116,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
116
116
|
end
|
117
117
|
|
118
118
|
create_table "titles", id: false, force: :cascade do |t|
|
119
|
-
t.integer
|
120
|
-
t.string
|
121
|
-
t.date
|
122
|
-
t.date
|
119
|
+
t.integer "emp_no", null: false
|
120
|
+
t.string "title", limit: 50, null: false
|
121
|
+
t.date "from_date", null: false
|
122
|
+
t.date "to_date"
|
123
|
+
t.serial "title_no", null: false
|
124
|
+
t.bigserial "title_bigno", null: false
|
123
125
|
t.index ["emp_no"], name: "idx_titles_emp_no", <%= i cond(5.0, using: :btree) %>
|
124
126
|
end
|
125
127
|
ERB
|
@@ -149,6 +151,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
149
151
|
t.column("age", :integer, **{:null=>false})
|
150
152
|
t.column("updated_at", :date, **{})
|
151
153
|
end
|
154
|
+
|
155
|
+
change_table("titles", bulk: true) do |t|
|
156
|
+
t.column("title_no", :serial, **{:null=>false})
|
157
|
+
t.column("title_bigno", :bigserial, **{:null=>false})
|
158
|
+
end
|
152
159
|
RUBY
|
153
160
|
delta.migrate
|
154
161
|
expect(subject.dump).to match_ruby expected_dsl
|
@@ -157,6 +157,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
157
157
|
create_table "clubs", force: :cascade do |t|
|
158
158
|
t.string "name", default: "", null: false
|
159
159
|
t.text "desc"
|
160
|
+
t.serial "club_no"
|
161
|
+
t.bigserial "club_bigno"
|
160
162
|
end
|
161
163
|
ERB
|
162
164
|
end
|
@@ -166,6 +168,8 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
166
168
|
create_table "clubs", force: :cascade do |t|
|
167
169
|
t.string "name", default: "", null: false
|
168
170
|
t.text "desc"
|
171
|
+
t.serial "club_no"
|
172
|
+
t.bigserial "club_bigno"
|
169
173
|
end
|
170
174
|
ERB
|
171
175
|
end
|
@@ -54,10 +54,12 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
create_table "titles", id: false, force: :cascade do |t|
|
57
|
-
t.integer
|
58
|
-
t.string
|
59
|
-
t.date
|
60
|
-
t.date
|
57
|
+
t.integer "emp_no", null: false
|
58
|
+
t.string "title", limit: 50, null: false
|
59
|
+
t.date "from_date", null: false
|
60
|
+
t.date "to_date"
|
61
|
+
t.serial "title_no", null: false
|
62
|
+
t.bigserial "title_bigno", null: false
|
61
63
|
t.index ["emp_no"], name: "idx_titles_emp_no", <%= i cond(5.0, using: :btree) %>
|
62
64
|
end
|
63
65
|
ERB
|
@@ -148,6 +150,11 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
148
150
|
t.remove("last_name")
|
149
151
|
t.remove("hire_date")
|
150
152
|
end
|
153
|
+
|
154
|
+
change_table("titles", bulk: true) do |t|
|
155
|
+
t.remove("title_no")
|
156
|
+
t.remove("title_bigno")
|
157
|
+
end
|
151
158
|
RUBY
|
152
159
|
delta.migrate
|
153
160
|
expect(subject.dump).to match_ruby expected_dsl
|
data/spec/spec_condition.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -25,10 +25,11 @@ require 'erb_helper'
|
|
25
25
|
|
26
26
|
RSpec.configure do |config|
|
27
27
|
config.before(:all) do
|
28
|
-
if condition(:debug)
|
28
|
+
if condition(:debug) || condition(:verbose)
|
29
29
|
ActiveRecord::Migration.verbose = true
|
30
30
|
logger = Ridgepole::Logger.instance
|
31
31
|
logger.level = ::Logger::DEBUG
|
32
|
+
logger.verbose = condition(:verbose)
|
32
33
|
ActiveRecord::Base.logger = logger
|
33
34
|
else
|
34
35
|
ActiveRecord::Migration.verbose = false
|
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.8.
|
4
|
+
version: 0.8.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -218,14 +218,42 @@ dependencies:
|
|
218
218
|
requirements:
|
219
219
|
- - ">="
|
220
220
|
- !ruby/object:Gem::Version
|
221
|
-
version:
|
221
|
+
version: 1.7.0
|
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:
|
228
|
+
version: 1.7.0
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: rubocop-rake
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: 0.5.1
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: 0.5.1
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: rubocop-rspec
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: 2.1.0
|
250
|
+
type: :development
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: 2.1.0
|
229
257
|
description: Ridgepole is a tool to manage DB schema. It defines DB schema using Rails
|
230
258
|
DSL, and updates DB schema according to DSL.
|
231
259
|
email:
|
@@ -235,10 +263,10 @@ executables:
|
|
235
263
|
extensions: []
|
236
264
|
extra_rdoc_files: []
|
237
265
|
files:
|
266
|
+
- ".github/workflows/test.yml"
|
238
267
|
- ".gitignore"
|
239
268
|
- ".rspec"
|
240
269
|
- ".rubocop.yml"
|
241
|
-
- ".travis.yml"
|
242
270
|
- Appraisals
|
243
271
|
- Gemfile
|
244
272
|
- LICENSE.txt
|
@@ -429,7 +457,7 @@ homepage: https://github.com/winebarrel/ridgepole
|
|
429
457
|
licenses:
|
430
458
|
- MIT
|
431
459
|
metadata: {}
|
432
|
-
post_install_message:
|
460
|
+
post_install_message:
|
433
461
|
rdoc_options: []
|
434
462
|
require_paths:
|
435
463
|
- lib
|
@@ -444,8 +472,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
444
472
|
- !ruby/object:Gem::Version
|
445
473
|
version: '0'
|
446
474
|
requirements: []
|
447
|
-
rubygems_version: 3.
|
448
|
-
signing_key:
|
475
|
+
rubygems_version: 3.1.2
|
476
|
+
signing_key:
|
449
477
|
specification_version: 4
|
450
478
|
summary: Ridgepole is a tool to manage DB schema.
|
451
479
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
dist: trusty
|
2
|
-
sudo: required
|
3
|
-
group: edge
|
4
|
-
language: ruby
|
5
|
-
cache:
|
6
|
-
- bundler
|
7
|
-
rvm:
|
8
|
-
- 2.4.9
|
9
|
-
- 2.5.7
|
10
|
-
- 2.6.5
|
11
|
-
- 2.7.1
|
12
|
-
before_script:
|
13
|
-
- sudo service mysql stop
|
14
|
-
- sudo service postgresql stop
|
15
|
-
- for i in {1..60}; do docker-compose up -d && break; sleep 1; done
|
16
|
-
- function mysql_ping { mysqladmin -u root -h 127.0.0.1 -P 13316 -ppassword ping; }
|
17
|
-
- function mysql57_ping { mysqladmin -u root -h 127.0.0.1 -P 13317 -ppassword ping; }
|
18
|
-
- function pg_ping { PGPASSWORD=password pg_isready -U postgres -h 127.0.0.1 -p 15442; }
|
19
|
-
- for i in {1..60}; do mysql_ping && break; sleep 1; done
|
20
|
-
- for i in {1..60}; do mysql57_ping && break; sleep 1; done
|
21
|
-
- for i in {1..60}; do pg_ping && break; sleep 1; done
|
22
|
-
script:
|
23
|
-
- bundle exec rake
|
24
|
-
gemfile:
|
25
|
-
- gemfiles/activerecord_5.0.gemfile
|
26
|
-
- gemfiles/activerecord_5.1.gemfile
|
27
|
-
- gemfiles/activerecord_5.2.gemfile
|
28
|
-
- gemfiles/activerecord_6.0.gemfile
|
29
|
-
env:
|
30
|
-
matrix:
|
31
|
-
- MYSQL56=1
|
32
|
-
- MYSQL57=1
|
33
|
-
- POSTGRESQL=1
|
34
|
-
services:
|
35
|
-
- docker
|
36
|
-
addons:
|
37
|
-
apt:
|
38
|
-
packages:
|
39
|
-
- mysql-client-core-5.6
|
40
|
-
- mysql-client-5.6
|
41
|
-
- postgresql-client-9.4
|
42
|
-
matrix:
|
43
|
-
exclude:
|
44
|
-
- rvm: 2.4.9
|
45
|
-
gemfile: gemfiles/activerecord_6.0.gemfile
|