Skip to content

Commit 41d0675

Browse files
committed
SET SINGLE_USER before dropping the database
to make sure no other connections are alive
1 parent a2a1619 commit 41d0675

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/active_record/connection_adapters/sqlserver/database_tasks.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def create_database(database, options = {})
1212

1313
def drop_database(database)
1414
name = SQLServer::Utils.extract_identifiers(database)
15+
do_execute "ALTER DATABASE #{name} SET SINGLE_USER WITH ROLLBACK IMMEDIATE"
1516
do_execute "DROP DATABASE #{name}"
1617
end
1718

0 commit comments

Comments
 (0)