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 CHANGED
@@ -1,5 +1,9 @@
1
1
  CHANGELOG
2
2
 
3
+ == 0.2.1
4
+
5
+ * Bug fix - cast :unique => nil to false in DbIndex.
6
+
3
7
  == 0.2.0
4
8
 
5
9
  * Switched to using the new style 'change' block in the generated
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
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
- !! @unique
27
+ @unique
28
28
  end
29
29
 
30
30
  # Returns true if this index has more than one column.
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sequel_migration_builder}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Roland Swingler"]
@@ -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
@@ -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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Roland Swingler