Closed
Description
According to the init command documentation giving the --path
option should create the directory if it does not exist but, because there is a existence check in CommandLine.java#validOptions method that is preventing this behavior.
Please find below the output when trying to initialize a non-existent directory
$ migrate --path=/tmp/nonexistent init
Migrations path must be a directory: /tmp/nonexistent
Usage: migrate command [parameter] [--path=<directory>] [--env=<environment>] [--template=<path to custom template>]
--path=<directory> Path to repository. Default current working directory.
--env=<environment> Environment to configure. Default environment is 'development'.
--template=<template> Path to custom template for creating new sql scripts.
--force Forces script to continue even if SQL errors are encountered.
--help Displays this usage message.
--trace Shows additional error details (if any).
--quiet Suppresses output.
--color Colorize output.
Commands:
info Display build version informations.
init Creates (if necessary) and initializes a migration path.
bootstrap Runs the bootstrap SQL script (see scripts/bootstrap.sql for more).
new <description> Creates a new migration with the provided description.
up [n] Run unapplied migrations, ALL by default, or 'n' specified.
down [n] Undoes migrations applied to the database. ONE by default or 'n' specified.
version <version> Migrates the database up or down to the specified version.
pending Force executes pending migrations out of order (not recommended).
status Prints the changelog from the database if the changelog table exists.
script <v1> <v2> Generates a delta migration script from version v1 to v2 (undo if v1 > v2).
* Shortcuts are accepted by using the first few (unambiguous) letters of each command..