Module: Cell::SanityCheck
- Defined in:
- lib/cell/sanity_check.rb
Class Method Summary collapse
Class Method Details
.check_active_record_adapter! ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cell/sanity_check.rb', line 5 def self.check_active_record_adapter! pg_base_adapter = ActiveRecord::ConnectionAdapters::PostgreSQLAdapter whitelist = [] adapter_name = ActiveRecord::Base.connection.adapter_name unless ActiveRecord::Base.connection.is_a?(pg_base_adapter) || whitelist.include?(adapter_name) msg " Cell uses PostgreSQL-specific features that cannot be represented with your adapter. If\n your adapter is a PostgreSQL spin-off, please open a pull request.\n\n Whitelist: \#{whitelist.inspect}\n ActiveRecord adapter: \#{adapter_name}\n EOD\n fail msg\n end\nrescue ActiveRecord::NoDatabaseError\n # Not our problem\nend\n" |
.check_dump_schemas! ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/cell/sanity_check.rb', line 39 def self.check_dump_schemas! dump_schemas = Rails.application.config.active_record.dump_schemas unless dump_schemas.to_s.match(/\bcell_prototype\b/) msg = " Cell stores tenant templates in a PostgreSQL schema called \"cell_prototype\".\n\n Rails will not dump this schema by default with `db:structure:dump` without explicitly\n setting `dump_schemas`.\n\n You can configure this by adding a line like the following in application.rb:\n\n Rails.application.config.active_record.dump_schemas = \"public,cell_prototype\"\n EOD\n fail msg\n end\nend\n" |
.check_schema_format! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cell/sanity_check.rb', line 26 def self.check_schema_format! if Rails.application.config.active_record.schema_format != :sql msg = " Cell uses PostgreSQL-specific features that cannot be represented using a schema_format\n other than :sql. You need a definititive structure.sql instead of a schema.rb. You can\n configure this by adding the following line to your application.rb:\n\n Rails.application.config.active_record.schema_format = :sql\n EOD\n fail msg\n end\nend\n" |