aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-03 20:06:46 +0000
committerJon Leighton <j@jonathanleighton.com>2011-12-03 20:06:46 +0000
commit51c2ef0b819d4732fff59cf1a86336dac38f2280 (patch)
tree1489428a9667e0b74784f3265f4ba19e0964c570
parent9c172b29311452a0e8eed42dfca64dbb5b168a94 (diff)
downloadrails-51c2ef0b819d4732fff59cf1a86336dac38f2280.tar.gz
rails-51c2ef0b819d4732fff59cf1a86336dac38f2280.tar.bz2
rails-51c2ef0b819d4732fff59cf1a86336dac38f2280.zip
Avoid postgres 9.X syntax
-rw-r--r--activerecord/test/cases/adapters/postgresql/schema_test.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/test/cases/adapters/postgresql/schema_test.rb b/activerecord/test/cases/adapters/postgresql/schema_test.rb
index d08f0b324d..18670b4177 100644
--- a/activerecord/test/cases/adapters/postgresql/schema_test.rb
+++ b/activerecord/test/cases/adapters/postgresql/schema_test.rb
@@ -68,11 +68,15 @@ class SchemaTest < ActiveRecord::TestCase
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?