Browse files

Ignore index creation errors if using create_table? with the IF NOT E…

…XISTS syntax (Fixes #362), bump version to 3.24.1
  • Loading branch information...
1 parent 5d2af0a commit 4a25463d89eb458adaae684d78d501fe5aedaa8a @jeremyevans committed Jun 3, 2011
Showing with 15 additions and 2 deletions.
  1. +4 −0 CHANGELOG
  2. +1 −1 lib/sequel/database/schema_methods.rb
  3. +1 −1 lib/sequel/version.rb
  4. +9 −0 spec/integration/schema_test.rb
View
4 CHANGELOG
@@ -1,3 +1,7 @@
+=== 3.24.1 (2011-06-03)
+
+* Ignore index creation errors if using create_table? with the IF NOT EXISTS syntax (jeremyevans) (#362)
+
=== 3.24.0 (2011-06-01)
* Add prepared_statements_association plugin, for using prepared statements by default for regular association loading (jeremyevans)
View
2 lib/sequel/database/schema_methods.rb
@@ -363,7 +363,7 @@ def create_table_from_generator(name, generator, options)
# Execute the create index statements using the generator.
def create_table_indexes_from_generator(name, generator, options)
- e = options[:ignore_index_errors]
+ e = options[:ignore_index_errors] || options[:if_not_exists]
generator.indexes.each do |index|
begin
index_sql_list(name, [index]).each{|sql| execute_ddl(sql)}
View
2 lib/sequel/version.rb
@@ -6,7 +6,7 @@ module Sequel
MINOR = 24
# The tiny version of Sequel. Usually 0, only bumped for bugfix
# releases that fix regressions from previous versions.
- TINY = 0
+ TINY = 1
# The version of Sequel you are using, as a string (e.g. "2.11.0")
VERSION = [MAJOR, MINOR, TINY].join('.')
View
9 spec/integration/schema_test.rb
@@ -183,6 +183,15 @@
@db[:items].columns.should == [:b]
end
+ specify "should have create_table? work correctly with indexes" do
+ @db.create_table!(:items){String :a, :index=>true}
+ @db.create_table?(:items){String :b, :index=>true}
+ @db[:items].columns.should == [:a]
+ @db.drop_table(:items) rescue nil
+ @db.create_table?(:items){String :b, :index=>true}
+ @db[:items].columns.should == [:b]
+ end
+
specify "should rename tables correctly" do
@db.drop_table(:items) rescue nil
@db.create_table!(:items2){Integer :number}

0 comments on commit 4a25463

Please sign in to comment.