This PR introduces a new configuration option called createTables to the database adapters. This option allows users to toggle whether the database adapters should attempt to run their table creation (DDL) schema files.
Context & Motivation:
In certain production environments, database servers are configured to disable Data Definition Language (DDL) modifications, such as table creation, to maintain stability and security. In such cases, automatically running the table creation schema may result in errors or unintended behavior.
To address this, the createTables option provides more flexibility by allowing users to control whether schema creation is attempted during database initialization.
Changes:
New Config Option:
Added createTables to the configuration file.
Type: Boolean
Default: true (maintains current behavior).
When set to false, the database adapters will skip running their schema creation scripts, preventing any DDL operations.
Database Adapter Updates:
Modified the logic in each relevant database adapter to check the createTables flag before executing any schema creation scripts.
Usage:
To disable table creation in a production environment:
... other configs ...
# Whether to run the creation SQL on the database when the server starts. Don't modify this unless you know what you're doing!
create_tables: false
... other configs ...
This ensures that the application will not attempt to modify the database schema, preventing any conflicts with database policies that disable DDL operations.
Testing:
Manual tests were performed on environments where DDL operations are disabled to confirm the configuration works as expected.
Impact:
Backward Compatibility: The default value of createTables is set to true, ensuring that existing functionality remains unchanged for users who do not modify their configuration.
Production Safety: Provides a safe and configurable way to disable DDL operations in production environments, reducing the risk of errors caused by unauthorized schema modifications.
Potential Issues: If createTables is set to false and the required database schema is not already in place, this can lead to runtime errors or missing tables. This setting should only be used by users who are certain that the schema has already been applied to the database. It is recommended for advanced users familiar with their database environment and schema management processes.
Summary:
This PR introduces a new configuration option called
createTables
to the database adapters. This option allows users to toggle whether the database adapters should attempt to run their table creation (DDL) schema files.Context & Motivation:
In certain production environments, database servers are configured to disable Data Definition Language (DDL) modifications, such as table creation, to maintain stability and security. In such cases, automatically running the table creation schema may result in errors or unintended behavior.
To address this, the
createTables
option provides more flexibility by allowing users to control whether schema creation is attempted during database initialization.Changes:
New Config Option:
createTables
to the configuration file.Boolean
true
(maintains current behavior).false
, the database adapters will skip running their schema creation scripts, preventing any DDL operations.Database Adapter Updates:
createTables
flag before executing any schema creation scripts.Usage:
To disable table creation in a production environment:
This ensures that the application will not attempt to modify the database schema, preventing any conflicts with database policies that disable DDL operations.
Testing:
Impact:
createTables
is set totrue
, ensuring that existing functionality remains unchanged for users who do not modify their configuration.createTables
is set tofalse
and the required database schema is not already in place, this can lead to runtime errors or missing tables. This setting should only be used by users who are certain that the schema has already been applied to the database. It is recommended for advanced users familiar with their database environment and schema management processes.