instance method
schema_exists?
Ruby on Rails 4.2.9
Since v4.2.9Signature
schema_exists?(name)
Returns true if schema exists.
Parameters
-
namereq
Source
# File activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb, line 131
def schema_exists?(name)
exec_query(<<-SQL, 'SCHEMA').rows.first[0].to_i > 0
SELECT COUNT(*)
FROM pg_namespace
WHERE nspname = '#{name}'
SQL
end
Defined in activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb line 131
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements