sequel_migration_builder 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/lib/sequel/schema/db_index.rb +2 -2
- data/sequel_migration_builder.gemspec +1 -1
- data/spec/alter_table_operations_spec.rb +10 -0
- data/spec/db_index_spec.rb +4 -0
- metadata +3 -3
data/CHANGELOG
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -19,12 +19,12 @@ module Sequel
|
|
19
19
|
def initialize(name, columns, unique=false)
|
20
20
|
@name = name.to_sym
|
21
21
|
@columns = columns.kind_of?(Array) ? columns.clone : [columns]
|
22
|
-
@unique = unique
|
22
|
+
@unique = !! unique
|
23
23
|
end
|
24
24
|
|
25
25
|
# Returns true if this index is unique
|
26
26
|
def unique?
|
27
|
-
|
27
|
+
@unique
|
28
28
|
end
|
29
29
|
|
30
30
|
# Returns true if this index has more than one column.
|
@@ -127,4 +127,14 @@ describe "Sequel::Schema::AlterTableOperations.build" do
|
|
127
127
|
|
128
128
|
ops.last.should be_nil
|
129
129
|
end
|
130
|
+
|
131
|
+
it "should not output an add_index statement if there is nothing to be done" do
|
132
|
+
table_a = {:name => :example_table,
|
133
|
+
:indexes => {:foo_idx => {:columns => [:foo]}},
|
134
|
+
:columns => []}
|
135
|
+
table_b = {:name => :example_table, :indexes => {:foo_idx => {:columns => [:foo]}}, :columns => []}
|
136
|
+
|
137
|
+
ops = Sequel::Schema::AlterTableOperations.build(table_a,table_b)
|
138
|
+
ops.should == []
|
139
|
+
end
|
130
140
|
end
|
data/spec/db_index_spec.rb
CHANGED
@@ -42,6 +42,10 @@ describe Sequel::Schema::DbIndex do
|
|
42
42
|
i1.hash.should == Sequel::Schema::DbIndex.new('foo_idx', :foo, true).hash
|
43
43
|
i1.should be_eql(Sequel::Schema::DbIndex.new('foo_idx', :foo, true))
|
44
44
|
end
|
45
|
+
|
46
|
+
it "should ensure nil as unique is converted to false" do
|
47
|
+
([Sequel::Schema::DbIndex.new(:foo_idx, :foo, :unique => nil)] - [Sequel::Schema::DbIndex.new(:foo_idx, :foo, :unique => false)]).should == []
|
48
|
+
end
|
45
49
|
|
46
50
|
it "can be built from a hash returned by Sequel::Database#indexes" do
|
47
51
|
hsh = {:foo_idx => {:columns => [:foo], :unique => true}}
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequel_migration_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Roland Swingler
|