ridgepole 0.7.1 → 0.7.2.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -3
- data/Appraisals +8 -0
- data/README.md +2 -0
- data/docker-compose.yml +2 -2
- data/gemfiles/activerecord_5.2.gemfile +11 -0
- data/lib/ridgepole/ext/schema_dumper.rb +1 -1
- data/lib/ridgepole/schema_statements_ext.rb +2 -2
- data/lib/ridgepole/version.rb +1 -1
- data/ridgepole.gemspec +1 -0
- data/spec/erb_helper.rb +3 -1
- data/spec/mysql/_migrate/migrate_change_table_option_spec.rb +5 -5
- data/spec/mysql/bigint_pk/int_pk_spec.rb +2 -2
- data/spec/mysql/collation/collation_spec.rb +15 -15
- data/spec/mysql/comment/comment_spec.rb +10 -10
- data/spec/mysql/default_lambda/default_lambda_spec.rb +2 -2
- data/spec/mysql/diff/diff2_spec.rb +4 -4
- data/spec/mysql/diff/diff_spec.rb +4 -4
- data/spec/mysql/dump/dump_class_method_spec.rb +3 -3
- data/spec/mysql/dump/dump_some_tables_spec.rb +2 -2
- data/spec/mysql/dump/dump_spec.rb +3 -3
- data/spec/mysql/dump/dump_unknown_column_type_spec.rb +1 -1
- data/spec/mysql/dump/dump_without_table_options_spec.rb +2 -2
- data/spec/mysql/fk/migrate_change_fk_spec.rb +16 -16
- data/spec/mysql/fk/migrate_create_fk_spec.rb +14 -14
- data/spec/mysql/fk/migrate_drop_fk_spec.rb +18 -18
- data/spec/mysql/migrate/migrate_add_column2_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_add_column_order_spec.rb +12 -12
- data/spec/mysql/migrate/migrate_add_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_add_column_with_alter_extra_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_add_column_with_script_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column3_spec.rb +14 -14
- data/spec/mysql/migrate/migrate_change_column5_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_column6_spec.rb +11 -11
- data/spec/mysql/migrate/migrate_change_column7_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_column_default_spec.rb +20 -20
- data/spec/mysql/migrate/migrate_change_column_float_spec.rb +9 -4
- data/spec/mysql/migrate/migrate_change_column_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index3_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_change_index4_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_change_index5_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index6_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_change_index7_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index8_spec.rb +7 -7
- data/spec/mysql/migrate/migrate_change_index_spec.rb +3 -3
- data/spec/mysql/migrate/migrate_change_table_option_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_check_relation_column_type_spec.rb +8 -8
- data/spec/mysql/migrate/migrate_create_index2_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_create_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_table_with_index_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_create_table_with_script_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_drop_column_and_index2_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_and_index_spec.rb +6 -6
- data/spec/mysql/migrate/migrate_drop_column_and_unique_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_drop_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_empty_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_execute_spec.rb +23 -23
- data/spec/mysql/migrate/migrate_log_file_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_merge_mode_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_noop_spec.rb +27 -27
- data/spec/mysql/migrate/migrate_primary_key_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_rename_column_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_rename_table_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_same_default_null_spec.rb +4 -4
- data/spec/mysql/migrate/migrate_same_spec.rb +5 -5
- data/spec/mysql/migrate/migrate_script_error_spec.rb +1 -1
- data/spec/mysql/migrate/migrate_skip_drop_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_skip_rename_column_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_skip_rename_table_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_ignore_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_pre_post_query_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_tables_spec.rb +2 -2
- data/spec/mysql/migrate/migrate_with_verbose_log_spec.rb +2 -2
- data/spec/mysql/migrate_/migrate_create_index_with_alter_spec.rb +2 -2
- data/spec/mysql/migrate_/migrate_drop_index_with_alter_spec.rb +2 -2
- data/spec/mysql/text_blob_types/text_blob_types_spec.rb +1 -1
- data/spec/mysql/~default_name_fk/migrate_change_fk_spec.rb +4 -4
- data/spec/mysql/~default_name_fk/migrate_create_fk_spec.rb +9 -9
- data/spec/mysql/~default_name_fk/migrate_drop_fk_spec.rb +6 -6
- data/spec/mysql/~dump_auto_increment/migrate_create_table_with_index_spec.rb +2 -2
- data/spec/mysql57/json/add_json_column_spec.rb +2 -2
- data/spec/mysql57/json/change_json_column_spec.rb +6 -6
- data/spec/mysql57/json/drop_json_column_spec.rb +2 -2
- data/spec/mysql57/virtual/add_virtual_column_spec.rb +2 -2
- data/spec/mysql57/virtual/change_virtual_column_spec.rb +2 -2
- data/spec/mysql57/virtual/drop_virtual_column_spec.rb +2 -2
- data/spec/postgresql/dump/dump_spec.rb +3 -3
- data/spec/postgresql/fk/migrate_change_fk_spec.rb +2 -2
- data/spec/postgresql/fk/migrate_create_fk_spec.rb +8 -8
- data/spec/postgresql/fk/migrate_drop_fk_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_add_column_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_bigint_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_change_column_default_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_change_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_change_index_spec.rb +3 -3
- data/spec/postgresql/migrate/migrate_check_relation_column_type_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_create_table_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb +8 -8
- data/spec/postgresql/migrate/migrate_drop_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_drop_index_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_drop_table_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_ext_cols_spec.rb +2 -2
- data/spec/postgresql/migrate/migrate_references_spec.rb +6 -6
- data/spec/postgresql/migrate/migrate_rename_column_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_rename_table_spec.rb +4 -4
- data/spec/postgresql/migrate/migrate_same_spec.rb +5 -5
- data/spec/postgresql/~default_name_fk/migrate_change_fk_spec.rb +1 -1
- data/spec/postgresql/~default_name_fk/migrate_create_fk_spec.rb +4 -4
- data/spec/postgresql/~default_name_fk/migrate_drop_fk_spec.rb +2 -2
- data/spec/spec_condition.rb +7 -0
- data/spec/spec_helper.rb +1 -0
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7319dc643a56f2417a20536a52d64d6b83abb83b
|
4
|
+
data.tar.gz: '088ee747f3c078b55b1c9ce32bc0ace3969502c5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60e566a779bd9e5beb702b950ad738946c7b3df77b0d0249ee1dfd0b11b395f25b44470dde0f40848cb9dbc4715b2e09da3abe160ea88ffbc7c9f3f6924dfc10
|
7
|
+
data.tar.gz: 56bddabd3f673ab2e803891fe298732b33c28b23e529104647e9f43e56e57fc2c0ed36e2d487fb49ca723da3d79fb5fe8d76890a24c0876345330770173bde9e
|
data/.travis.yml
CHANGED
@@ -6,9 +6,9 @@ cache:
|
|
6
6
|
- bundler
|
7
7
|
- apt
|
8
8
|
rvm:
|
9
|
-
- 2.2.
|
10
|
-
- 2.3.
|
11
|
-
- 2.4.
|
9
|
+
- 2.2.9
|
10
|
+
- 2.3.6
|
11
|
+
- 2.4.3
|
12
12
|
before_install:
|
13
13
|
- gem install bundler
|
14
14
|
before_script:
|
@@ -26,6 +26,7 @@ script:
|
|
26
26
|
gemfile:
|
27
27
|
- gemfiles/activerecord_5.0.gemfile
|
28
28
|
- gemfiles/activerecord_5.1.gemfile
|
29
|
+
- gemfiles/activerecord_5.2.gemfile
|
29
30
|
env:
|
30
31
|
matrix:
|
31
32
|
- MYSQL56=1
|
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -84,6 +84,8 @@ It defines DB schema using [Rails DSL](http://guides.rubyonrails.org/migrations.
|
|
84
84
|
* Add `--allow-pk-change` option
|
85
85
|
* Add `--create-table-with-index` option
|
86
86
|
* Add `--mysql-dump-auto-increment` option (`rails >= 5.1`)
|
87
|
+
* `>= 0.7.2`
|
88
|
+
* Support Rails 5.2
|
87
89
|
|
88
90
|
## Installation
|
89
91
|
|
data/docker-compose.yml
CHANGED
@@ -19,7 +19,7 @@ module Ridgepole
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def foreign_keys(table, stream)
|
22
|
-
return super unless
|
22
|
+
return super unless ActiveRecord::SchemaDumper.__with_default_fk_name
|
23
23
|
|
24
24
|
if (foreign_keys = @connection.foreign_keys(table)).any?
|
25
25
|
add_foreign_key_statements = foreign_keys.map do |foreign_key|
|
@@ -2,7 +2,7 @@ require 'active_record/connection_adapters/abstract/schema_statements'
|
|
2
2
|
|
3
3
|
module Ridgepole
|
4
4
|
module SchemaStatementsExt
|
5
|
-
def index_name_exists?(
|
5
|
+
def index_name_exists?(*)
|
6
6
|
if Ridgepole::ExecuteExpander.noop
|
7
7
|
caller_methods = caller.map {|i| i =~ /:\d+:in `(.+)'/ ? $1 : '' }
|
8
8
|
if caller_methods.any? {|i| i =~ /\Aremove_index/ }
|
@@ -17,7 +17,7 @@ module Ridgepole
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def rename_table_indexes(
|
20
|
+
def rename_table_indexes(*)
|
21
21
|
# Nothing to do
|
22
22
|
end
|
23
23
|
end
|
data/lib/ridgepole/version.rb
CHANGED
data/ridgepole.gemspec
CHANGED
@@ -33,4 +33,5 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency 'erbh', '>= 0.1.2'
|
34
34
|
spec.add_development_dependency 'hash_modern_inspect', '>= 0.1.1'
|
35
35
|
spec.add_development_dependency 'hash_order_helper', '>= 0.1.6'
|
36
|
+
spec.add_development_dependency 'rspec-match_ruby', '>= 0.1.3'
|
36
37
|
end
|
data/spec/erb_helper.rb
CHANGED
@@ -16,9 +16,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
16
16
|
erbh(<<-EOS)
|
17
17
|
create_table "employees", primary_key: "emp_no", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=ascii" do |t|
|
18
18
|
t.date "birth_date", null: false
|
19
|
-
t.string "first_name", limit: 14, null: false
|
20
|
-
t.string "last_name", limit: 16, null: false
|
21
|
-
t.string "gender", limit: 1, null: false
|
19
|
+
t.string "first_name", limit: 14, null: false, <%= i cond(5.2, collation: "utf8_general_ci") %>
|
20
|
+
t.string "last_name", limit: 16, null: false, <%= i cond(5.2, collation: "utf8_general_ci") %>
|
21
|
+
t.string "gender", limit: 1, null: false, <%= i cond(5.2, collation: "utf8_general_ci") %>
|
22
22
|
t.date "hire_date", null: false
|
23
23
|
end
|
24
24
|
EOS
|
@@ -30,9 +30,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
30
30
|
it {
|
31
31
|
delta = subject.diff(expected_dsl)
|
32
32
|
expect(delta.differ?).to be_truthy
|
33
|
-
expect(subject.dump).to
|
33
|
+
expect(subject.dump).to match_ruby actual_dsl
|
34
34
|
delta.migrate
|
35
|
-
expect(subject.dump).to
|
35
|
+
expect(subject.dump).to match_ruby expected_dsl
|
36
36
|
}
|
37
37
|
end
|
38
38
|
end
|
@@ -17,7 +17,7 @@ describe 'Ridgepole::Client (with integer pk)', condition: 5.1 do
|
|
17
17
|
|
18
18
|
specify {
|
19
19
|
expect(show_create_table(:books)).to include '`id` int(11) NOT NULL AUTO_INCREMENT'
|
20
|
-
expect(subject.dump).to
|
20
|
+
expect(subject.dump).to match_ruby dsl
|
21
21
|
}
|
22
22
|
end
|
23
23
|
|
@@ -39,7 +39,7 @@ describe 'Ridgepole::Client (with integer pk)', condition: 5.1 do
|
|
39
39
|
|
40
40
|
specify {
|
41
41
|
expect(show_create_table(:books)).to include '`id` bigint(20) NOT NULL AUTO_INCREMENT'
|
42
|
-
expect(subject.dump).to
|
42
|
+
expect(subject.dump).to match_ruby dsl
|
43
43
|
}
|
44
44
|
end
|
45
45
|
end
|
@@ -2,7 +2,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
2
2
|
context 'when change column (add collation)' do
|
3
3
|
let(:actual_dsl) {
|
4
4
|
erbh(<<-EOS)
|
5
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
5
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
6
6
|
t.integer "emp_no", null: false
|
7
7
|
t.integer "club_id", null: false, unsigned: true
|
8
8
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -13,7 +13,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
13
13
|
|
14
14
|
let(:expected_dsl) {
|
15
15
|
erbh(<<-EOS)
|
16
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
16
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
17
17
|
t.integer "emp_no", null: false
|
18
18
|
t.integer "club_id", null: false, unsigned: true
|
19
19
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -28,16 +28,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
28
28
|
specify {
|
29
29
|
delta = subject.diff(expected_dsl)
|
30
30
|
expect(delta.differ?).to be_truthy
|
31
|
-
expect(subject.dump).to
|
31
|
+
expect(subject.dump).to match_ruby actual_dsl
|
32
32
|
delta.migrate
|
33
|
-
expect(subject.dump).to
|
33
|
+
expect(subject.dump).to match_ruby expected_dsl
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
37
37
|
context 'when change column (delete collation)' do
|
38
38
|
let(:actual_dsl) {
|
39
39
|
erbh(<<-EOS)
|
40
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
40
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
41
41
|
t.integer "emp_no", null: false
|
42
42
|
t.integer "club_id", null: false, unsigned: true
|
43
43
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -48,7 +48,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
48
48
|
|
49
49
|
let(:expected_dsl) {
|
50
50
|
erbh(<<-EOS)
|
51
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
51
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
52
52
|
t.integer "emp_no", null: false
|
53
53
|
t.integer "club_id", null: false, unsigned: true
|
54
54
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -63,16 +63,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
63
63
|
specify {
|
64
64
|
delta = subject.diff(expected_dsl)
|
65
65
|
expect(delta.differ?).to be_truthy
|
66
|
-
expect(subject.dump).to
|
66
|
+
expect(subject.dump).to match_ruby actual_dsl
|
67
67
|
delta.migrate
|
68
|
-
expect(subject.dump).to
|
68
|
+
expect(subject.dump).to match_ruby expected_dsl
|
69
69
|
}
|
70
70
|
end
|
71
71
|
|
72
72
|
context 'when change column (change collation)' do
|
73
73
|
let(:actual_dsl) {
|
74
74
|
erbh(<<-EOS)
|
75
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
75
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
76
76
|
t.integer "emp_no", null: false
|
77
77
|
t.integer "club_id", null: false, unsigned: true
|
78
78
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -83,7 +83,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
83
83
|
|
84
84
|
let(:expected_dsl) {
|
85
85
|
erbh(<<-EOS)
|
86
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
86
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
87
87
|
t.integer "emp_no", null: false
|
88
88
|
t.integer "club_id", null: false, unsigned: true
|
89
89
|
t.string "string", null: false, collation: "utf8mb4_bin"
|
@@ -98,16 +98,16 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
98
98
|
specify {
|
99
99
|
delta = subject.diff(expected_dsl)
|
100
100
|
expect(delta.differ?).to be_truthy
|
101
|
-
expect(subject.dump).to
|
101
|
+
expect(subject.dump).to match_ruby actual_dsl
|
102
102
|
delta.migrate
|
103
|
-
expect(subject.dump).to
|
103
|
+
expect(subject.dump).to match_ruby expected_dsl
|
104
104
|
}
|
105
105
|
end
|
106
106
|
|
107
107
|
context 'when change column (no change collation)' do
|
108
108
|
let(:actual_dsl) {
|
109
109
|
erbh(<<-EOS)
|
110
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
110
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :bigint) %>, unsigned: true, force: :cascade do |t|
|
111
111
|
t.integer "emp_no", null: false
|
112
112
|
t.integer "club_id", null: false, unsigned: true
|
113
113
|
t.string "string", null: false, collation: "ascii_bin"
|
@@ -122,9 +122,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
122
122
|
specify {
|
123
123
|
delta = subject.diff(actual_dsl)
|
124
124
|
expect(delta.differ?).to be_falsey
|
125
|
-
expect(subject.dump).to
|
125
|
+
expect(subject.dump).to match_ruby actual_dsl
|
126
126
|
delta.migrate
|
127
|
-
expect(subject.dump).to
|
127
|
+
expect(subject.dump).to match_ruby actual_dsl
|
128
128
|
}
|
129
129
|
|
130
130
|
describe '#diff' do
|
@@ -28,9 +28,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
28
28
|
it {
|
29
29
|
delta = subject.diff(expected_dsl)
|
30
30
|
expect(delta.differ?).to be_truthy
|
31
|
-
expect(subject.dump).to
|
31
|
+
expect(subject.dump).to match_ruby actual_dsl
|
32
32
|
delta.migrate
|
33
|
-
expect(subject.dump).to
|
33
|
+
expect(subject.dump).to match_ruby expected_dsl
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
@@ -63,9 +63,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
63
63
|
it {
|
64
64
|
delta = subject.diff(expected_dsl)
|
65
65
|
expect(delta.differ?).to be_truthy
|
66
|
-
expect(subject.dump).to
|
66
|
+
expect(subject.dump).to match_ruby actual_dsl
|
67
67
|
delta.migrate
|
68
|
-
expect(subject.dump).to
|
68
|
+
expect(subject.dump).to match_ruby expected_dsl
|
69
69
|
}
|
70
70
|
end
|
71
71
|
|
@@ -98,9 +98,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
98
98
|
it {
|
99
99
|
delta = subject.diff(expected_dsl)
|
100
100
|
expect(delta.differ?).to be_truthy
|
101
|
-
expect(subject.dump).to
|
101
|
+
expect(subject.dump).to match_ruby actual_dsl
|
102
102
|
delta.migrate
|
103
|
-
expect(subject.dump).to
|
103
|
+
expect(subject.dump).to match_ruby expected_dsl
|
104
104
|
}
|
105
105
|
end
|
106
106
|
|
@@ -122,9 +122,9 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
122
122
|
it {
|
123
123
|
delta = subject.diff(actual_dsl)
|
124
124
|
expect(delta.differ?).to be_falsey
|
125
|
-
expect(subject.dump).to
|
125
|
+
expect(subject.dump).to match_ruby actual_dsl
|
126
126
|
delta.migrate
|
127
|
-
expect(subject.dump).to
|
127
|
+
expect(subject.dump).to match_ruby actual_dsl
|
128
128
|
}
|
129
129
|
end
|
130
130
|
|
@@ -147,7 +147,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
147
147
|
expect(delta.differ?).to be_truthy
|
148
148
|
expect(subject.dump.strip).to be_empty
|
149
149
|
delta.migrate
|
150
|
-
expect(subject.dump).to
|
150
|
+
expect(subject.dump).to match_ruby expected_dsl
|
151
151
|
}
|
152
152
|
end
|
153
153
|
|
@@ -169,7 +169,7 @@ describe 'Ridgepole::Client#diff -> migrate' do
|
|
169
169
|
it {
|
170
170
|
delta = subject.diff('')
|
171
171
|
expect(delta.differ?).to be_truthy
|
172
|
-
expect(subject.dump).to
|
172
|
+
expect(subject.dump).to match_ruby actual_dsl
|
173
173
|
delta.migrate
|
174
174
|
expect(subject.dump).to be_empty
|
175
175
|
}
|
@@ -62,9 +62,9 @@ describe 'Ridgepole::Client (use default:lambda)' do
|
|
62
62
|
expect(delta.differ?).to be_truthy
|
63
63
|
delta.migrate
|
64
64
|
|
65
|
-
expect(subject.dump).to
|
65
|
+
expect(subject.dump).to match_ruby erbh(<<-EOS)
|
66
66
|
create_table "foos", force: :cascade do |t|
|
67
|
-
t.datetime "bar", default:
|
67
|
+
t.datetime "bar", default: "1970-01-01 00:00:00", null: false
|
68
68
|
end
|
69
69
|
EOS
|
70
70
|
end
|
@@ -172,11 +172,11 @@ describe 'Ridgepole::Client.diff' do
|
|
172
172
|
it {
|
173
173
|
delta = subject.diff(actual_dsl, expected_dsl)
|
174
174
|
expect(delta.differ?).to be_truthy
|
175
|
-
expect(delta.script).to
|
176
|
-
change_column("employee_clubs", "club_id", :integer, <%= {:unsigned=>false, :null=>true, :default=>nil} + cond(5.1, comment: nil) %>)
|
175
|
+
expect(delta.script).to match_ruby erbh(<<-EOS)
|
176
|
+
change_column("employee_clubs", "club_id", :integer, <%= {:unsigned=>false, :null=>true, :default=>nil} + cond('>= 5.1', comment: nil) %>)
|
177
177
|
|
178
|
-
change_column("employees", "last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond(5.1, comment: nil) %>)
|
179
|
-
change_column("employees", "gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond(5.1, comment: nil) %>)
|
178
|
+
change_column("employees", "last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
|
179
|
+
change_column("employees", "gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
|
180
180
|
EOS
|
181
181
|
}
|
182
182
|
|
@@ -146,11 +146,11 @@ describe 'Ridgepole::Client.diff' do
|
|
146
146
|
it {
|
147
147
|
delta = subject.diff(actual_dsl, expected_dsl)
|
148
148
|
expect(delta.differ?).to be_truthy
|
149
|
-
expect(delta.script).to
|
150
|
-
change_column("employee_clubs", "club_id", :integer, <%= {:unsigned=>false, :null=>true, :default=>nil} + cond(5.1, comment: nil) %>)
|
149
|
+
expect(delta.script).to match_ruby erbh(<<-EOS)
|
150
|
+
change_column("employee_clubs", "club_id", :integer, <%= {:unsigned=>false, :null=>true, :default=>nil} + cond('>= 5.1', comment: nil) %>)
|
151
151
|
|
152
|
-
change_column("employees", "last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond(5.1, comment: nil) %>)
|
153
|
-
change_column("employees", "gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond(5.1, comment: nil) %>)
|
152
|
+
change_column("employees", "last_name", :string, <%= {:limit=>20, :default=>"XXX", :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
|
153
|
+
change_column("employees", "gender", :string, <%= {:limit=>2, :null=>false, :default=>nil, :unsigned=>false} + cond('>= 5.1', comment: nil) %>)
|
154
154
|
EOS
|
155
155
|
}
|
156
156
|
end
|
@@ -5,7 +5,7 @@ describe 'Ridgepole::Client.dump' do
|
|
5
5
|
|
6
6
|
it {
|
7
7
|
expect(subject.dump(conn_spec, dump_without_table_options: true)).to match_fuzzy erbh(<<-EOS)
|
8
|
-
create_table "clubs", <%= i cond(5.1, id: :integer) %>, unsigned: true, force: :cascade do |t|
|
8
|
+
create_table "clubs", <%= i cond('>= 5.1', id: :integer) %>, unsigned: true, force: :cascade do |t|
|
9
9
|
t.string "name", default: "", null: false
|
10
10
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
11
11
|
end
|
@@ -33,13 +33,13 @@ describe 'Ridgepole::Client.dump' do
|
|
33
33
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
34
34
|
end
|
35
35
|
|
36
|
-
create_table "employee_clubs", <%= i cond(5.1, id: :integer) %>, unsigned: true, force: :cascade do |t|
|
36
|
+
create_table "employee_clubs", <%= i cond('>= 5.1', id: :integer) %>, unsigned: true, force: :cascade do |t|
|
37
37
|
t.integer "emp_no", null: false, unsigned: true
|
38
38
|
t.integer "club_id", null: false, unsigned: true
|
39
39
|
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", <%= i cond(5.0, using: :btree) %>
|
40
40
|
end
|
41
41
|
|
42
|
-
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond(5.1, default: nil) %>, force: :cascade do |t|
|
42
|
+
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond('>= 5.1', default: nil) %>, force: :cascade do |t|
|
43
43
|
t.date "birth_date", null: false
|
44
44
|
t.string "first_name", limit: 14, null: false
|
45
45
|
t.string "last_name", limit: 16, null: false
|
@@ -5,7 +5,7 @@ describe 'Ridgepole::Client#dump' do
|
|
5
5
|
|
6
6
|
it {
|
7
7
|
expect(subject.dump).to match_fuzzy erbh(<<-EOS)
|
8
|
-
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond(5.1, default: nil) %>, force: :cascade do |t|
|
8
|
+
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond('>= 5.1', default: nil) %>, force: :cascade do |t|
|
9
9
|
t.date "birth_date", null: false
|
10
10
|
t.string "first_name", limit: 14, null: false
|
11
11
|
t.string "last_name", limit: 16, null: false
|
@@ -39,7 +39,7 @@ describe 'Ridgepole::Client#dump' do
|
|
39
39
|
|
40
40
|
it {
|
41
41
|
expect(subject.dump).to match_fuzzy erbh(<<-EOS)
|
42
|
-
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond(5.1, default: nil) %>, force: :cascade do |t|
|
42
|
+
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond('>= 5.1', default: nil) %>, force: :cascade do |t|
|
43
43
|
t.date "birth_date", null: false
|
44
44
|
t.string "first_name", limit: 14, null: false
|
45
45
|
t.string "last_name", limit: 16, null: false
|
@@ -5,7 +5,7 @@ describe 'Ridgepole::Client#dump' do
|
|
5
5
|
|
6
6
|
it {
|
7
7
|
expect(subject.dump).to match_fuzzy erbh(<<-EOS)
|
8
|
-
create_table "clubs", <%= i cond(5.1,
|
8
|
+
create_table "clubs", <%= i cond('>= 5.1',id: :integer) %>, unsigned: true, force: :cascade do |t|
|
9
9
|
t.string "name", default: "", null: false
|
10
10
|
t.index ["name"], name: "idx_name", unique: true, <%= i cond(5.0, using: :btree) %>
|
11
11
|
end
|
@@ -33,13 +33,13 @@ describe 'Ridgepole::Client#dump' do
|
|
33
33
|
t.index ["emp_no"], name: "emp_no", <%= i cond(5.0, using: :btree) %>
|
34
34
|
end
|
35
35
|
|
36
|
-
create_table "employee_clubs", <%= i cond(5.1,
|
36
|
+
create_table "employee_clubs", <%= i cond('>= 5.1',id: :integer) %>, unsigned: true, force: :cascade do |t|
|
37
37
|
t.integer "emp_no", null: false, unsigned: true
|
38
38
|
t.integer "club_id", null: false, unsigned: true
|
39
39
|
t.index ["emp_no", "club_id"], name: "idx_emp_no_club_id", <%= i cond(5.0, using: :btree) %>
|
40
40
|
end
|
41
41
|
|
42
|
-
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond(5.1,
|
42
|
+
create_table "employees", primary_key: "emp_no", id: :integer, <%= i cond('>= 5.1',default: nil) %>, force: :cascade do |t|
|
43
43
|
t.date "birth_date", null: false
|
44
44
|
t.string "first_name", limit: 14, null: false
|
45
45
|
t.string "last_name", limit: 16, null: false
|