diff --git a/cli/README.md b/cli/README.md index e0cc6467..65c8a244 100644 --- a/cli/README.md +++ b/cli/README.md @@ -10,10 +10,16 @@ Once the `dbdev` TLE is installed select dbdev.install('math', '0.0.1'); ``` -Where the `dbdev` CLI functions as a backup solution for installing packages when requirements for the `dbdev` TLE are not met (no [pgsql-http](https://github.com/pramsey/pgsql-http)) +Where the `dbdev` CLI functions as a backup solution for installing local packages when requirements for the `dbdev` TLE are not met (no [pgsql-http](https://github.com/pramsey/pgsql-http)) ``` -dbdev install --connection 'postgresql://...' --package 'math' --version '0.0.1' +dbdev install --connection 'postgresql://...' path --directory ./math +``` + +To list package versions installed into `pg_tle` and available to enable with `create extension`, run: + +``` +dbdev list --connection 'postgresql://...' ``` ## Objective Statements @@ -37,6 +43,7 @@ Usage: dbdev [OPTIONS] Commands: install Install a package to a database + list List available packages uninstall Uninstall a package from a database help Print this message or the help of the given subcommand(s) @@ -55,12 +62,31 @@ Options: ``` Install a package to a database -Usage: dbdev install [OPTIONS] --connection +Usage: dbdev install [OPTIONS] --connection + +Options: + -c, --connection PostgreSQL connection string + -h, --help Print help + +Sources: + path From a local directory +``` + +For example, to install a package from a local directory: + +``` +dbdev install --connection 'postgresql://postgres:postgres@localhost:54322/postgres' path --directory ./pg_idkit +``` + +### list + +``` +List available packages + +Usage: dbdev list --connection Options: -c, --connection PostgreSQL connection string - -p, --package Package name on package index - --path From local directory -h, --help Print help ``` diff --git a/website/content/docs/cli.mdx b/website/content/docs/cli.mdx index 2bd952cf..a04720a4 100644 --- a/website/content/docs/cli.mdx +++ b/website/content/docs/cli.mdx @@ -103,3 +103,25 @@ Alternatively, you can build the binary from source. You will need to have [Rust If you have [cargo-install](https://doc.rust-lang.org/cargo/commands/cargo-install.html), you can perform all the above steps with a single command: `cargo install --git https://github.com/supabase/dbdev.git dbdev`. Now you're ready to [publish your first package](/docs/publish-extension). + +## Developer Commands + +If you are developing a package locally, the following dbdev commands will be useful. + +### Install a Local Package + +Use `dbdev install` to install a local TLE package into the connected database: + +```bash +dbdev install --connection "postgresql://postgres:postgres@localhost:54322/postgres" path --directory ./pg_idkit +``` + +The `path` source defaults to the current directory when `--directory` is omitted. + +### List Installed Package Versions + +Use `dbdev list` to list package versions installed into `pg_tle` and available to enable with `CREATE EXTENSION`: + +```bash +dbdev list --connection "postgresql://postgres:postgres@localhost:54322/postgres" +```