Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init command does not accept non-existent path #225

Closed
xshyamx opened this issue Jun 17, 2022 · 1 comment
Closed

Init command does not accept non-existent path #225

xshyamx opened this issue Jun 17, 2022 · 1 comment
Assignees
Labels
Milestone

Comments

@xshyamx
Copy link
Contributor

xshyamx commented Jun 17, 2022

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..
@h3adache h3adache added the bug label Jun 18, 2022
@xshyamx
Copy link
Contributor Author

xshyamx commented Jun 24, 2022

On the same vein info also has the same problem

$ migrate info --path=/tmp/nonexistent 
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..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants