Skip to content

Commit 756f205

Browse files
committed
The #remove_default_constraint uses #execute_procedure now.
* Fixes #223. * Thanks @gicappa and @clintmiller.
1 parent 2b78957 commit 756f205

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11

2+
* 3.2.9 *
3+
4+
* The #remove_default_constraint uses #execute_procedure now. Fixes #223. Thanks @gicappa and @clintmiller.
5+
6+
7+
28
* 3.2.8 *
39

4-
Include VERSION in gemspec's files.
10+
* Include VERSION in gemspec's files.
511

612

713
* 3.2.7 *

lib/active_record/connection_adapters/sqlserver/schema_statements.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def remove_check_constraints(table_name, column_name)
250250

251251
def remove_default_constraint(table_name, column_name)
252252
# If their are foreign keys in this table, we could still get back a 2D array, so flatten just in case.
253-
select_all("EXEC sp_helpconstraint '#{quote_string(table_name)}','nomsg'").flatten.select do |row|
253+
execute_procedure(:sp_helpconstraint, table_name, 'nomsg').flatten.select do |row|
254254
row['constraint_type'] == "DEFAULT on column #{column_name}"
255255
end.each do |row|
256256
do_execute "ALTER TABLE #{quote_table_name(table_name)} DROP CONSTRAINT #{row['constraint_name']}"

test/cases/migration_test_sqlserver.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def setup
4848

4949
should 'not drop the default contraint if just renaming' do
5050
find_default = lambda do
51-
@connection.select_all("EXEC sp_helpconstraint 'defaults','nomsg'").select do |row|
51+
@connection.execute_procedure(:sp_helpconstraint, 'defaults', 'nomsg').select do |row|
5252
row['constraint_type'] == "DEFAULT on column decimal_number"
5353
end.last
5454
end

0 commit comments

Comments
 (0)