1.4.0
- Breaking: Changed error behavior so that a query that fails now throws, rather than logging the error and resolving to
{ error }, which is what every database driver underneath does, and what code written against one expects. Code that did not check for{ error }carried on as though a failed query had worked. A query against a database whose driver is not installed or that never connected, and a query argument that is not a query, throw too. The newthrowOnErrorparam controls this: set it tofalseto restore the old behavior. The CLI scripts keep the old behavior. - Added
db.transaction(work), which runs several queries, including different statements, as one transaction on one connection, committing them onceworkresolves and rolling them back if it throws. Transactions made by passing an array of rows todb.query()run one statement once for each row, and still work as before. - Updated dependencies.
1.3.0
- Breaking: Apps no longer fall back to guessed credentials when their configured credentials fail, unless the
NODE_ENVenvironment variable is set todevelopment. The newguessCredentialsparam controls this: set it totrueto always guess, which restores the old behavior,'development'to guess only in development, which is the default for apps, orfalseto never guess, including from the CLI. A warning is now logged whenever a guessed set of credentials is the one that connects. - Changed MariaDB, MySQL, and PostgreSQL queries to go through the connection pool rather than through one connection checked out of it at startup. This change should improve performance and stability.
- Fixed a bug that caused a single insert or update to be run as a transaction when its first param was
null, a date, a buffer, or any other object, which ran the query once per param and threw onnull. Params are now treated as transaction rows only when every one of them is an array or a plain object. - Fixed a bug that caused a failed connection attempt to leave its pool open, which could keep the process from exiting.
- Fixed a bug that caused an idle PostgreSQL connection that dropped to crash the process, since the error it emits had no listener.
- Fixed the reason each connection attempt failed being thrown away. When no credentials connect, each attempt and its error are now logged.
- Fixed
loggerConfig.warnbeing ignored, which prevented the CLI's--suppress-logsflag from suppressing warnings. - Fixed database drivers being loaded from Multi-DB Driver's own dependencies rather than the app's whenever it has copies of its own, such as when it is linked to a clone or installed by a package manager that keeps each package's dependencies apart, such as pnpm. Drivers are now loaded from the app, found from the working directory the same way the config file is, with Multi-DB Driver's own copy as the fallback.
- Updated dependencies.
1.2.2
- Fixed a bug that caused the message logged on a successful database connection to print
[Function: bold]instead of naming the user and database that were connected to. - Fixed a bug that left
db.driverand eachdb.[database].driverundefined instead of exposing the loaded driver module as documented. - Simplified much of the code and removed some dependencies.
1.2.1
- Fixed a bug that prevented Multi-DB Driver from being loaded at all in contexts where
process.argv[1]is undefined, such as the Node REPL ornode -e. - Reduced the size of the published npm package by excluding the test suite and development tooling from it.
1.2.0
- Fixed a bug that caused the
--createCLI command to create MySQL and MariaDB users that could only connect from the database server's own host, which prevented the created user from logging in from anywhere else. - Fixed a bug that caused the
--dump-schemaand--dump-dataCLI commands to ignore the configured host and port, always attempting to dump from the default port on localhost. - Fixed a bug that caused
testConnectionto report a successful connection when the connection test query had failed. - Fixed a bug that prevented
~from working in file paths. Paths beginning with~are now expanded to the current user's home directory in SQLite and PGlite database paths, schema paths, the--file,--dump-schema, and--dump-dataCLI arguments, and theMULTI_DB_DRIVER_CONFIG_LOCATIONenvironment variable. - Improved the error reported when a configured database's driver is not installed: Multi-DB Driver now names the missing package and the command to install it, instead of reporting that the database is configured improperly. Queries against such a database report the same thing, rather than failing with an error about an undefined property.
- Updated dependencies.
1.1.3
- Fixed a bug that prevented errors from surfacing at times.
- Updated dependencies.
1.1.2
- Fixed a bug that prevented the most recent versions of MariaDB from working.
- Updated dependencies.
1.1.1
- Altered
configFinder.jsto look for both.multi-db-config.jsonand.multi-db-driver-config.jsonwhen searching for user defined config file. - Updated dependencies.
1.1.0
- Changed all instances of
multi-db,MULTI_DB, etc tomulti-db-driver,MULTI_DB_DRIVER, etc for clarity. - Updated various dependencies.
1.0.2
- Altered the logic of the
querymethod to perform a transaction ifparamsis supplied an array of objects or an array of arrays. - Fixed a CLI text alignment issue.
- Updated dependencies.
1.0.1
- Fixed README typo regarding the npm package name.
1.0.0
- Initial commit.