Class: Apartment::Adapters::PostgresqlSchemaFromSqlAdapter
- Inherits:
-
PostgresqlSchemaAdapter
- Object
- AbstractAdapter
- PostgresqlSchemaAdapter
- Apartment::Adapters::PostgresqlSchemaFromSqlAdapter
- Defined in:
- lib/apartment/adapters/postgresql_adapter.rb
Overview
Another Adapter for Postgresql when using schemas and SQL
Constant Summary collapse
- PSQL_DUMP_BLACKLISTED_STATEMENTS =
[ /SET search_path/i, # overridden later /SET lock_timeout/i, # new in postgresql 9.3 /SET row_security/i, # new in postgresql 9.5 /SET idle_in_transaction_session_timeout/i, # new in postgresql 9.6 /SET default_table_access_method/i, # new in postgresql 12 /CREATE SCHEMA/i, /COMMENT ON SCHEMA/i, /SET transaction_timeout/i, # new in postgresql 17 ].freeze
- PSQL_META_COMMANDS =
PostgreSQL meta-commands (backslash commands) that appear in pg_dump output but are not valid SQL when passed to ActiveRecord’s execute(). These must be filtered out to prevent syntax errors during schema import.
[ /^\\connect/i, /^\\set/i, /^\\unset/i, /^\\copyright/i, /^\\echo/i, /^\\warn/i, /^\\o/i, /^\\t/i, /^\\q/i, /^\\./i, # Catch-all for any backslash command (e.g., \. for COPY delimiter, # \restrict/\unrestrict in PostgreSQL 17.6+, and future meta-commands) ].freeze
- PSQL_DUMP_GLOBAL_BLACKLIST =
Combined blacklist: SQL statements and psql meta-commands to filter from pg_dump output
(PSQL_DUMP_BLACKLISTED_STATEMENTS + PSQL_META_COMMANDS).freeze
Instance Attribute Summary
Attributes inherited from AbstractAdapter
Instance Method Summary collapse
Methods inherited from PostgresqlSchemaAdapter
#current, #default_tenant, #init, #initialize, #reset
Methods inherited from AbstractAdapter
#create, #current, #drop, #each, #environmentify, #init, #initialize, #process_excluded_models, #reset, #seed_data, #switch, #switch!
Constructor Details
This class inherits a constructor from Apartment::Adapters::PostgresqlSchemaAdapter
Instance Method Details
#import_database_schema ⇒ Object
177 178 179 180 181 182 |
# File 'lib/apartment/adapters/postgresql_adapter.rb', line 177 def import_database_schema preserving_search_path do clone_pg_schema copy_schema_migrations end end |