Skip to content

Commit

Permalink
Ignore index creation errors if using create_table? with the IF NOT E…
Browse files Browse the repository at this point in the history
…XISTS syntax (Fixes jeremyevans#362), bump version to 3.24.1
  • Loading branch information
jeremyevans committed Jun 3, 2011
1 parent 5d2af0a commit 4a25463
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion lib/sequel/database/schema_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
2 changes: 1 addition & 1 deletion lib/sequel/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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('.')
Expand Down
9 changes: 9 additions & 0 deletions spec/integration/schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 4a25463

Please sign in to comment.