- Update
glob
to latest dependency, which technically only supportsNode v20 or later
. Which technically, makes this a breaking change?
-
Support
sqlite3
andbetter-sqlite3
migrations with;
in statements. -
Add
execSqlScript
option to execute migrations consisting of multiple statements. If not supplied, Postgrator will fallback to usingexecQuery
.
- Support
better-sqlite3
- Fix migration method code comment
- Use INTEGER for sqlite3 version type
- Add
sqlite3
support
getDatabaseVersion
returns 0 when schema version table does not exist instead ofundefined
. This is technically breaking if you rely on theundefined
returned in version 5.0.1.- Fix DEP0151 warning about ext resolution
Postgrator is now an ES module and requires Node 14 or later. .cjs
and .mjs
migration files are now supported.
No other changes have been made.
- Fix
getDatabaseVersion
error when schemaversion table does not exist.undefined
is returned instead.
Version 5 represents an effort to simplify things, allow more flexibility, and reduce the maintenance of this package.
This is made possible by requiring the database query execution function be injected to postgrator. Postgrator no longer manages the database connection, and as a result no longer needs to maintain a mapping to specific database driver implementations.
Despite all the breaking changes below, nothing has changed in the overall migration file approach. Migrations that worked for previous versions of postgrator will still work in v5.
See examples/
directory for quick overview of how v5 is used.
- md5 validation may be skipped for specific migrations by deleting the md5 value from your DB's schemaversion table.
- Honors uppercase characters in postgres schema table name (#98)
- JS migrations no longer run during validation, preventing unwanted migration failures (#124)
- Nodejs 12 or later required.
- Removed
host
,port
,username
,password
,ssl
,options
. Manage connections withexecQuery
instead. - Driver value
mysql2
unsupported. (You can still use themysql2
package for yourexecQuery
implementation, but set driver tomysql
) - Removed
migrationDirectory
option. UsemigrationPattern
instead. In most cases it will bepath/to/migrations/*
. Any glob syntax supported. - Removed
GO
keyword splitting formssql
. UsingGO
could leave your system in a partially migrated state on failure and is not recommended. - filename in migration result is full file path
- Removed md5 checksum validation for JS migrations. JS migrations are dynamic, and JS style trends could vary over time if a tool like Prettier is applied.
- JS migrations do not generate SQL until immediately prior to being applied. Previously, JS migrations generated SQL prior to any migrations running. This was problematic for cases where JS migrations no longer successfullly generated SQL.
- Undeprecate
currentSchema
config. It'll stay for v5.
- Add
execQuery
function option to allow maximum flexibility in database connection management. Postgrator-owned database connections (the connections established using host, username, password, etc.) are deprecated, and will be removed in Postgrator 5. - Deprecate
host
,port
,username
,password
,ssl
,options
,currentSchema
config. - Deprecate
runQuery
utility function (use your db driver directly). - Deprecate
migrationDirectory
in favor ofmigrationPattern
glob.
- Add support for
mssql
7
- Fix pg SSL config when using connectionString
- Add async function migration support
- Update dependencies
- Fix Postgres SSL typings
- BREAKING: Node.js 10 or later required
- Add support for
pg
8.x.x
- Fix to avoid running migrations with same number
- Update dependencies
- Fix Windows compat
- Add support for driver mysql2@2
- Add support for driver mssql@6
- Fix non-default schema use for mssql (#94)
- Fix MySQL option typings for mysql2
- Fix TypeScript type for currentSchema postgres option
- Add support for mssql 5.x
- Add mssql domain option
- Filter out non-migration files to avoid filename parsing errors
- Add currentSchema option for Postgres
- Add support for mysql2
- Add support for ssl config for mysql
- Fix: close db connection on migration error
- Fix: support schema detection for MySQL 8.0
- Fix: Don't wait for postgres connection end response
- Allow schema to be specified for schemaTable (Postgres only) If schema does not exist it will be created.
- Add connectionTimeout config for mssql
- Adds support for managing multiple databases/schemas on single cluster/database
- Adds incompatible version warnings for installed db drivers
- Add support for pg@6
- Fix: allow filenames longer than 32 char for mssql
- Add option to specify glob pattern for migration files
run_at
timestamp column added to schema tablemd5
andname
columns added for all implementations- Checksum validation now implemented for all drivers
- Checksum validation may be skipped using config
validateChecksums: false
- Callback API replaced with Promises
- Connections opened/closed automatically (no more
.endConnection()
) - Lots of tests
- Node 6 or greater now required
- DB drivers must be installed prior to use (
pg
,mysql
,mssql
) pg.js
andtedious
no longer valid driver config option- None of the API is the same
- Checksums now validated by default for all drivers
- Calling
.migrate()
without input migrates to latest/max - Logging to console removed
- Allow migration SQL to be generated via js function
- Added postgres ssl support
- Allow port configuration
- Added config to toggle logging progress
- Added config for requestTimeout
- Added support for mssql batches using GO keyword
- Exposed functions to get current/max migration versions
- Added config for schematable name
- Added config for checksum newline ending normalization
- Version column increased to BIGINT
- SQL Server connections closed with endConnection()
- Update db driver modules
- Update mssql config: timeout set to 1 hour
- Add version as PK on schemaversion table
- Checksum validation added for postgres
- postgrator.migrate('max', cb) added to migrate to latest version
Initial version released
Initial development