Skip to content

Commit

Permalink
Merge pull request #1 from gfoiani/master
Browse files Browse the repository at this point in the history
Drop view retro compatibility for SQL Server 2012
  • Loading branch information
silvabox committed Nov 21, 2018
2 parents 23182c2 + a4c8c76 commit 2830748
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/scenic/adapters/sql_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def update_view(name, sql)
end

def drop_view(name)
execute "DROP VIEW IF EXISTS #{quote_table_name(name)};"
execute "IF OBJECT_ID('#{quote_table_name(name)}') IS NOT NULL DROP VIEW #{quote_table_name(name)};"
end

class NotSupportedError < StandardError
Expand Down
2 changes: 1 addition & 1 deletion lib/scenic_sqlserver_adapter/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ScenicSqlserverAdapter
VERSION = "0.1.0"
VERSION = "0.1.1"
end
2 changes: 1 addition & 1 deletion spec/scenic/adapters/sql_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module Adapters

describe 'drop_view' do
it 'executes DROP VIEW SQL on the connection' do
expect(connection).to receive(:execute).with('DROP VIEW IF EXISTS [to_a_kill];')
expect(connection).to receive(:execute).with("IF OBJECT_ID('[to_a_kill]') IS NOT NULL DROP VIEW [to_a_kill];")
subject.drop_view('to_a_kill')
end
end
Expand Down

0 comments on commit 2830748

Please # to comment.