Skip to content

Commit

Permalink
Avoid postgres 9.X syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jonleighton committed Dec 3, 2011
1 parent 1583dab commit c1e2c1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/test/cases/adapters/postgresql/schema_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ def teardown
end

def test_schema_change_with_prepared_stmt
altered = false
@connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
@connection.exec_query "alter table developers add column zomg int", 'sql', []
altered = true
@connection.exec_query "select * from developers where id = $1", 'sql', [[nil, 1]]
ensure
@connection.exec_query "alter table developers drop column if exists zomg", 'sql', []
# We are not using DROP COLUMN IF EXISTS because that syntax is only
# supported by pg 9.X
@connection.exec_query("alter table developers drop column zomg", 'sql', []) if altered
end

def test_table_exists?
Expand Down

0 comments on commit c1e2c1a

Please sign in to comment.