diff --git a/CHANGELOG b/CHANGELOG index d898a04af2..a9e9d57fc7 100644 --- a/CHANGELOG +++ b/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) diff --git a/lib/sequel/database/schema_methods.rb b/lib/sequel/database/schema_methods.rb index 76f983a6bd..483c04f101 100644 --- a/lib/sequel/database/schema_methods.rb +++ b/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)} diff --git a/lib/sequel/version.rb b/lib/sequel/version.rb index f733a0b4a4..bd3af8ec5e 100644 --- a/lib/sequel/version.rb +++ b/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('.') diff --git a/spec/integration/schema_test.rb b/spec/integration/schema_test.rb index 361303a49d..da7b3155ef 100644 --- a/spec/integration/schema_test.rb +++ b/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}