File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ require "cases/helper_sqlserver"
4
+ require "models/topic"
5
+ require "models/task"
6
+ require "models/post"
7
+ require "models/subscriber"
8
+ require "models/minimalistic"
9
+ require "models/college"
10
+
11
+ class TempTestSQLServer < ActiveRecord ::TestCase
12
+ # it "assert true" do
13
+ # assert true
14
+ # end
15
+
16
+ it "insert from one schema to another using raw SQL" do
17
+ arunit_connection = Topic . lease_connection
18
+ arunit2_connection = College . lease_connection
19
+
20
+ arunit_database = arunit_connection . pool . db_config . database
21
+ arunit2_database = arunit2_connection . pool . db_config . database
22
+
23
+ sql = <<~SQL
24
+ INSERT INTO #{ arunit2_database } .dbo.dogs SELECT * FROM #{ arunit_database } .dbo.dogs(id)
25
+ SQL
26
+
27
+ assert_nothing_raised do
28
+ arunit_connection . execute ( sql )
29
+ end
30
+ end
31
+ end
You can’t perform that action at this time.
0 commit comments