From f8a6fa17c757182c42a8c9617d146f90ed69228f Mon Sep 17 00:00:00 2001 From: Roman Vanesyan Date: Wed, 9 Oct 2024 21:08:34 +0300 Subject: [PATCH] chore: more readme, fix init commands --- README.md | 17 +++++++++++++++++ internal/command/common/common.go | 2 +- internal/command/initialise/initialise.go | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bdf3fa..ead6bfa 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ An SQL migrator that is easy to embed. +## Getting started + +### Creating a new Conduit migration project + +To create a new conduit project run in the current directory: + +``` +$ conduit init +``` + +By default conduit initialises a new project in `$(cwd)/migrations` to create the project in a different location. + +``` +$ conduit init --migrations-dir path/to/project +``` + ## FAQ
@@ -19,3 +35,4 @@ Check out my post where I cover the topic in more detail: https://romanvanesyan. At this moment, it is unlikely that support will be added for any databases other than Postgres. conduit is built on top of the excellent Postgres driver - pgx, and uses specific Postgres functionality such as advisory locks.
+``` diff --git a/internal/command/common/common.go b/internal/command/common/common.go index 053450b..34f0b43 100644 --- a/internal/command/common/common.go +++ b/internal/command/common/common.go @@ -9,7 +9,7 @@ import ( var ( databaseUrlFlagName = "database-url" - migrationsDirFlagName = "dir" + migrationsDirFlagName = "migrations-dir" ) var DatabaseURLFlag = &cli.StringFlag{ diff --git a/internal/command/initialise/initialise.go b/internal/command/initialise/initialise.go index 5717114..fea8cf0 100644 --- a/internal/command/initialise/initialise.go +++ b/internal/command/initialise/initialise.go @@ -18,6 +18,7 @@ func NewCommand() *cli.Command { Aliases: []string{"i"}, Usage: "initialise migration directory", Flags: []cli.Flag{ + common.MigrationsDirFlag, &cli.StringFlag{ Name: "namespace", Aliases: []string{"ns"},