knex

SQL query builder for JavaScript

Subcommands

NameDescription
initCreate a fresh knexfile
migrate:makeCreate a named migration file
migrate:latestRun all migrations that have not yet been run
migrate:upRun the next or the specified migration that has not yet been run
migrate:rollbackRollback the last batch of migrations performed
migrate:downUndo the last or the specified migration that was already run
migrate:currentVersionView the current version for the migration
migrate:list|migrate:statusList all migrations files with status
migrate:unlockForcibly unlocks the migrations lock table
seed:makeCreate a named seed file
seed:runRun seed files
helpDisplay help for command

Options

NameDescription
--version <arg>Output the version number
--debug <arg>Run with debugging
--knexfile <arg>Specify the knexfile path
--knexpath <arg>Specify the path to knex instance
--cwd <arg>Specify the working directory
--client <arg>Set DB client without a knexfile
--connection <arg>Set DB connection without a knexfile
--migrations-directory <arg>Set migrations directory without a knexfile
--migrations-table-name <arg>Set migrations table name without a knexfile
--env <environment>Environment, default: process.env.NODE_ENV || development
--esm <arg>Enable ESM interop
--specific <arg>Specify one seed file to execute
--timestamp-filename-prefix <arg>Enable a timestamp prefix on name of generated seed files
--help <arg>Display help for command