Skip to content

Commit 47ac275

Browse files
committed
table_exists? now supports tables referenced by schema (and database) dbo.table db.dbo.table [#2]
1 parent e9a8840 commit 47ac275

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/active_record/connection_adapters/sqlserver_adapter.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,11 @@ def tables(name = nil)
719719
end
720720
end
721721

722+
def table_exists?(table_name)
723+
#If the table is external, see if it has columns
724+
super(table_name) || (columns(table_name).size>0)
725+
end
726+
722727
def indexes(table_name, name = nil)
723728
ActiveRecord::Base.connection.instance_variable_get("@connection")["AutoCommit"] = false
724729
__indexes(table_name, name)

0 commit comments

Comments
 (0)