Module: SchemaPlusMultischema::Middleware::PostgreSQL::Schema::Tables
- Defined in:
- lib/schema_plus_multischema/middleware.rb
Instance Method Summary collapse
Instance Method Details
#implement(env) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/schema_plus_multischema/middleware.rb', line 10 def implement(env) use_prefix = (env.connection.schema_search_path != DEFAULT_SCHEMA_SEARCH_PATH) query = <<-SQL SELECT schemaname, tablename FROM pg_tables WHERE schemaname = ANY(current_schemas(false)) SQL env.tables += env.connection.exec_query(query, 'SCHEMA').map { |row| if use_prefix "#{row['schemaname']}.#{row['tablename']}" else row['tablename'] end } end |