Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
- Inherits:
-
AbstractAdapter
show all
- Defined in:
- lib/empty_eye/active_record/connection_adapters/postgresql_adapter.rb
Instance Method Summary
collapse
#ordinary_table_exists?, #view_exists?
Instance Method Details
#tables(name = nil) ⇒ Object
5
6
7
|
# File 'lib/empty_eye/active_record/connection_adapters/postgresql_adapter.rb', line 5
def tables(name = nil)
tables_without_views(name) | views(name)
end
|
#tables_without_views(name = nil) ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/empty_eye/active_record/connection_adapters/postgresql_adapter.rb', line 9
def tables_without_views(name = nil)
query(<<-SQL, 'SCHEMA').map { |row| row[0] }
SELECT tablename
FROM pg_tables
WHERE schemaname = ANY (current_schemas(false))
SQL
end
|
#views(name = nil) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/empty_eye/active_record/connection_adapters/postgresql_adapter.rb', line 17
def views(name = nil)
query(<<-SQL, 'SCHEMA').map { |row| row[0] }
SELECT viewname
FROM pg_views
WHERE schemaname = ANY (current_schemas(false))
SQL
end
|