ridgepole 0.6.5.beta11 → 0.6.5.beta12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe78b203c5736b9c91293c2e678889afe4b1e927
|
4
|
+
data.tar.gz: d4bf1df43c6676eb5817b38cc377d02d826dab65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29d7d68475863ef2e2575eef3fb2162c38f84659c8f56c5b5c5f36d339f185a7c686ca7feb31ef5c9fd2192cbf87d23318630aaf36a468333daf2a873804f5d0
|
7
|
+
data.tar.gz: a8173e2d906dfef78b698abe9723aa0dad1ec67af06918095074934d599dcd7a170e7a7763a5240de74eee8aa802cd63eac45fc1dd4022c37b990c1f2d3b3e49
|
data/lib/ridgepole/diff.rb
CHANGED
@@ -168,7 +168,7 @@ class Ridgepole::Diff
|
|
168
168
|
modified_indices = []
|
169
169
|
|
170
170
|
from_indices.each do |name, attrs|
|
171
|
-
if attrs[:column_name].delete(column_name)
|
171
|
+
if attrs[:column_name].is_a?(Array) && attrs[:column_name].delete(column_name)
|
172
172
|
modified_indices << name
|
173
173
|
end
|
174
174
|
end
|
@@ -181,7 +181,7 @@ class Ridgepole::Diff
|
|
181
181
|
end
|
182
182
|
|
183
183
|
from_indices.reject! do |name, attrs|
|
184
|
-
attrs[:column_name].empty?
|
184
|
+
attrs[:column_name].is_a?(Array) && attrs[:column_name].empty?
|
185
185
|
end
|
186
186
|
end
|
187
187
|
end
|
@@ -303,6 +303,10 @@ class Ridgepole::Diff
|
|
303
303
|
end
|
304
304
|
|
305
305
|
def columns_all_include?(expected_columns, actual_columns, table_options)
|
306
|
+
unless expected_columns.is_a?(Array)
|
307
|
+
return true
|
308
|
+
end
|
309
|
+
|
306
310
|
if table_options[:id] != false
|
307
311
|
actual_columns = actual_columns + [(table_options[:primary_key] || 'id').to_s]
|
308
312
|
end
|
data/lib/ridgepole/version.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
describe 'Ridgepole::Client#diff -> migrate', condition: [:activerecord_5] do
|
2
|
+
subject { client }
|
3
|
+
|
4
|
+
before do
|
5
|
+
subject.diff(actual_dsl).migrate
|
6
|
+
end
|
7
|
+
|
8
|
+
context 'when drop column from table containing an expression index' do
|
9
|
+
let(:actual_dsl) { <<-EOS }
|
10
|
+
create_table "users", force: :cascade do |t|
|
11
|
+
t.string "name", null: false
|
12
|
+
t.datetime "created_at", null: false
|
13
|
+
t.index "lower((name)::text)", name: "index_users_on_lower_name", using: :btree
|
14
|
+
end
|
15
|
+
EOS
|
16
|
+
|
17
|
+
let(:expected_dsl) { <<-EOS }
|
18
|
+
create_table "users", force: :cascade do |t|
|
19
|
+
t.string "name", null: false
|
20
|
+
t.index "lower((name)::text)", name: "index_users_on_lower_name", using: :btree
|
21
|
+
end
|
22
|
+
EOS
|
23
|
+
|
24
|
+
specify do
|
25
|
+
delta = subject.diff(expected_dsl)
|
26
|
+
expect(delta).to be_differ
|
27
|
+
expect(delta.script).to match_fuzzy('remove_column("users", "created_at")')
|
28
|
+
expect(subject.dump).to match_fuzzy(actual_dsl)
|
29
|
+
delta.migrate
|
30
|
+
expect(subject.dump).to match_fuzzy(expected_dsl)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'when drop expression index' do
|
35
|
+
let(:actual_dsl) { <<-EOS }
|
36
|
+
create_table "users", force: :cascade do |t|
|
37
|
+
t.string "name", null: false
|
38
|
+
t.index "lower((name)::text)", name: "index_users_on_lower_name", using: :btree
|
39
|
+
end
|
40
|
+
EOS
|
41
|
+
|
42
|
+
let(:expected_dsl) { <<-EOS }
|
43
|
+
create_table "users", force: :cascade do |t|
|
44
|
+
t.string "name", null: false
|
45
|
+
end
|
46
|
+
EOS
|
47
|
+
|
48
|
+
specify do
|
49
|
+
delta = subject.diff(expected_dsl)
|
50
|
+
expect(delta).to be_differ
|
51
|
+
expect(delta.script).to match_fuzzy('remove_index("users", {:name=>"index_users_on_lower_name"})')
|
52
|
+
expect(subject.dump).to match_fuzzy(actual_dsl)
|
53
|
+
delta.migrate
|
54
|
+
expect(subject.dump).to match_fuzzy(expected_dsl)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridgepole
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.5.
|
4
|
+
version: 0.6.5.beta12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
@@ -327,6 +327,7 @@ files:
|
|
327
327
|
- spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb
|
328
328
|
- spec/postgresql/migrate/migrate_drop_column_spec.rb
|
329
329
|
- spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb
|
330
|
+
- spec/postgresql/migrate/migrate_drop_expression_index_spec.rb
|
330
331
|
- spec/postgresql/migrate/migrate_drop_index_spec.rb
|
331
332
|
- spec/postgresql/migrate/migrate_drop_table_spec.rb
|
332
333
|
- spec/postgresql/migrate/migrate_ext_cols_spec.rb
|
@@ -457,6 +458,7 @@ test_files:
|
|
457
458
|
- spec/postgresql/migrate/migrate_create_table_with_default_proc_spec.rb
|
458
459
|
- spec/postgresql/migrate/migrate_drop_column_spec.rb
|
459
460
|
- spec/postgresql/migrate/migrate_drop_column_with_index_spec.rb
|
461
|
+
- spec/postgresql/migrate/migrate_drop_expression_index_spec.rb
|
460
462
|
- spec/postgresql/migrate/migrate_drop_index_spec.rb
|
461
463
|
- spec/postgresql/migrate/migrate_drop_table_spec.rb
|
462
464
|
- spec/postgresql/migrate/migrate_ext_cols_spec.rb
|