Skip to content

Commit a228501

Browse files
committed
Coerce test
1 parent 68953a4 commit a228501

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

test/cases/coerced_tests.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,9 @@ def test_update_coerced
12671267
assert_not_predicate topic, :approved?
12681268
assert_equal "The First Topic", topic.title
12691269
end
1270+
1271+
# In SQL Server it's not possible to set the primary key column using a trigger and to get it then to return.
1272+
coerce_tests! :test_model_with_no_auto_populated_fields_still_returns_primary_key_after_insert
12701273
end
12711274

12721275
require "models/author"

test/schema/sqlserver_specific_schema.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -266,21 +266,6 @@
266266
SELECT pk_col_one AS id_source, event_name FROM INSERTED
267267
SQL
268268

269-
270-
execute <<-SQL
271-
CREATE TRIGGER instead_of_insert_trigger
272-
ON pk_autopopulated_by_a_trigger_records
273-
INSTEAD OF INSERT
274-
AS
275-
BEGIN
276-
INSERT INTO pk_autopopulated_by_a_trigger_records (
277-
[id]
278-
)
279-
SELECT ((COALESCE(MAX(pk_autopopulated_by_a_trigger_records.id), 0) + 1))
280-
FROM pk_autopopulated_by_a_trigger_records
281-
END
282-
SQL
283-
284269
# Another schema.
285270

286271
create_table :sst_schema_columns, force: true do |t|

0 commit comments

Comments
 (0)