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