lib/torque/postgresql/config.rb in torque-postgresql-2.4.5 vs lib/torque/postgresql/config.rb in torque-postgresql-3.0.0
- old
+ new
@@ -2,15 +2,10 @@
module Torque
module PostgreSQL
include ActiveSupport::Configurable
- # Stores a version check for compatibility purposes
- AR604 = (ActiveRecord.gem_version >= Gem::Version.new('6.0.4'))
- AR610 = (ActiveRecord.gem_version >= Gem::Version.new('6.1.0'))
- AR615 = (ActiveRecord.gem_version >= Gem::Version.new('6.1.5'))
-
# Use the same logger as the Active Record one
def self.logger
ActiveRecord::Base.logger
end
@@ -25,36 +20,18 @@
# Set if any information that requires querying and searching or collectiong
# information shuld be eager loaded. This automatically changes when rails
# same configuration is set to true
config.eager_load = false
- # This allows default values to have extended values like arrays and casted
- # values. Extended defaults are still experimental, so enable and test it
- # before using it in prod
- config.use_extended_defaults = false
-
# Set a list of irregular model name when associated with table names
config.irregular_models = {}
def config.irregular_models=(hash)
PostgreSQL.config[:irregular_models] = hash.map do |(table, model)|
[table.to_s, model.to_s]
end.to_h
end
- # Configure multiple schemas
- config.nested(:schemas) do |schemas|
-
- # Defines a list of LIKE-based schemas to not consider for a multiple
- # schema database
- schemas.blacklist = %w[information_schema pg_%]
-
- # Defines a list of LIKE-based schemas to consider for a multiple schema
- # database
- schemas.whitelist = %w[public]
-
- end
-
# Configure associations features
config.nested(:associations) do |assoc|
# Define if +belongs_to_many+ associations are marked as required by
# default. False means that no validation will be performed
@@ -67,29 +44,25 @@
# Define the key that is used on auxiliary statements to send extra
# arguments to format string or send on a proc
cte.send_arguments_key = :args
- # Estipulate a class name (which may contain namespace) that exposes the
+ # Estipulate a class name (which may contain namespace) that expose the
# auxiliary statement in order to perform detached CTEs
cte.exposed_class = 'TorqueCTE'
- # Estipulate a class name (which may contain namespace) that exposes the
- # recursive auxiliary statement in order to perform detached CTEs
- cte.exposed_recursive_class = 'TorqueRecursiveCTE'
-
end
# Configure ENUM features
config.nested(:enum) do |enum|
# The name of the method to be used on any ActiveRecord::Base to
# initialize model-based enum features
- enum.base_method = :enum
+ enum.base_method = :torque_enum
# The name of the method to be used on any ActiveRecord::Base to
# initialize model-based enum set features
- enum.set_method = :enum_set
+ enum.set_method = :torque_enum_set
# Indicates if bang methods like 'disabled!' should update the record on
# database or not
enum.save_on_bang = true