Class: DeployPin::DatabaseEngine
- Inherits:
-
Object
- Object
- DeployPin::DatabaseEngine
- Defined in:
- lib/deploy_pin/database_engine.rb
Overview
This class is used to detect used database engine and managing specific differences between them.
Defined Under Namespace
Modules: MariaDB, MySQL, PostgreSQL
Constant Summary collapse
- DB_ENGINES_MAPPING =
{ mariadb: MariaDB, mysql: MySQL, pg: PostgreSQL }.freeze
Instance Method Summary collapse
- #detect ⇒ Object
-
#initialize(connection) ⇒ DatabaseEngine
constructor
A new instance of DatabaseEngine.
Constructor Details
#initialize(connection) ⇒ DatabaseEngine
Returns a new instance of DatabaseEngine.
25 26 27 |
# File 'lib/deploy_pin/database_engine.rb', line 25 def initialize(connection) @connection = connection end |
Instance Method Details
#detect ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/deploy_pin/database_engine.rb', line 29 def detect db_engine_symbol = case connection.adapter_name when /postg/i then :pg when /mysql/i, /trilogy/i then detect_mysql_based_engine end DB_ENGINES_MAPPING[db_engine_symbol] end |