Skip to content

Commit c21f97f

Browse files
author
Matt Jarjoura
committed
sqlserver_adapter: fix azure again
1 parent 9eebe95 commit c21f97f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ def initialize(connection, logger, pool, config)
205205
@database_year = begin
206206
if @database_version =~ /Azure/i
207207
@sqlserver_azure = true
208-
@database_version.match(/\s(\d{4})\s/)[1].to_i
208+
@database_version.match(/\s-\s([0-9.]+)/)[1]
209+
year = 2012
209210
else
210211
year = DATABASE_VERSION_REGEXP.match(@database_version)[1]
211212
year == "Denali" ? 2011 : year.to_i
@@ -218,7 +219,7 @@ def initialize(connection, logger, pool, config)
218219
@edition = select_value "SELECT CAST(SERVERPROPERTY('edition') AS VARCHAR(128))", 'SCHEMA'
219220
initialize_dateformatter
220221
use_database
221-
unless SUPPORTED_VERSIONS.include?(@database_year)
222+
unless (@sqlserver_azure == true || SUPPORTED_VERSIONS.include?(@database_year))
222223
raise NotImplementedError, "Currently, only #{SUPPORTED_VERSIONS.to_sentence} are supported. We got back #{@database_version}."
223224
end
224225
end

0 commit comments

Comments
 (0)