module Landlady
Constants
- VERSION
Public Instance Methods
create_schema(name)
click to toggle source
# File lib/landlady.rb, line 20 def create_schema(name) sql = %{CREATE SCHEMA "#{name}"} ActiveRecord::Base.connection.execute sql end
default_search_path()
click to toggle source
# File lib/landlady.rb, line 7 def default_search_path @default_search_path ||= %{"$user", public} end
restore_default_search_path()
click to toggle source
# File lib/landlady.rb, line 16 def restore_default_search_path ActiveRecord::Base.connection.schema_search_path = default_search_path end
schemas()
click to toggle source
# File lib/landlady.rb, line 25 def schemas sql = "SELECT nspname FROM pg_namespace WHERE nspname !~ '^pg_.*'" ActiveRecord::Base.connection.query(sql).flatten end
set_search_path(name, include_public = true)
click to toggle source
# File lib/landlady.rb, line 11 def set_search_path(name, include_public = true) path_parts = [name.to_s, ("public" if include_public)].compact ActiveRecord::Base.connection.schema_search_path = path_parts.join(",") end