npm install @makerx/typeorm-pg-toolkit --save-dev
A set of useful TypeORM tools to work with Postgres
Supported features are:
migration-create
: Create an empty migration script.migration-generate
: Generate migration scripts to match the current Postgres database with the current entity model.migration-check
: Check for discrepancies between the current Postgres database and the current entity model.migration-revert
: Revert the latest migration script.
snapshot-create
: Create a snapshot of the current Postgres database.snapshot-restore
: Restore a snapshotsnapshot-clean
: Delete all snapshots
This toolkit expect you to set the below environment variables
TYPEORM_TOOLKIT_MIGRATION_DATASOURCE_CONFIG
: The path to TypeORM datasource file.TYPEORM_TOOLKIT_MIGRATION_ROOT_DIR
: The directory to generate new migration scripts to.
TYPEORM_TOOLKIT_DATABASE_HOST
: Postgres database hostTYPEORM_TOOLKIT_DATABASE_PORT
: Postgres database portTYPEORM_TOOLKIT_DATABASE_NAME
: Postgres database nameTYPEORM_TOOLKIT_DATABASE_USERNAME
: Postgres database usernameTYPEORM_TOOLKIT_DATABASE_PASSWORD
: Postgres database password
Note: The username must have permissions to create snapshot/restore permissions.