diff --git a/packages/wrangler/src/hyperdrive/client.ts b/packages/wrangler/src/hyperdrive/client.ts index 3777bf464fcd..8eeab42205b3 100644 --- a/packages/wrangler/src/hyperdrive/client.ts +++ b/packages/wrangler/src/hyperdrive/client.ts @@ -14,6 +14,7 @@ export type Origin = { }; export type PublicOrigin = Origin & { + scheme?: string; database?: string; user?: string; }; diff --git a/packages/wrangler/src/hyperdrive/create.ts b/packages/wrangler/src/hyperdrive/create.ts index 0e59e483bfb9..51dbf7691bd7 100644 --- a/packages/wrangler/src/hyperdrive/create.ts +++ b/packages/wrangler/src/hyperdrive/create.ts @@ -34,7 +34,11 @@ export async function handler( if (url.protocol === "") { logger.log("You must specify the database protocol - e.g. 'postgresql:'."); - } else if (url.protocol !== "postgresql:" && url.protocol !== "") { + } else if ( + url.protocol !== "postgresql:" && + url.protocol !== "postgres:" && + url.protocol !== "" + ) { logger.log( "Only PostgreSQL or PostgreSQL compatible databases are currently supported." ); @@ -65,6 +69,7 @@ export async function handler( origin: { host: url.hostname, port: parseInt(url.port), + scheme: url.protocol, database: url.pathname.replace("/", ""), user: url.username, password: url.password, diff --git a/packages/wrangler/src/hyperdrive/update.ts b/packages/wrangler/src/hyperdrive/update.ts index 7ab4eb61e22e..c3711e853fd1 100644 --- a/packages/wrangler/src/hyperdrive/update.ts +++ b/packages/wrangler/src/hyperdrive/update.ts @@ -18,20 +18,28 @@ export function options(yargs: CommonYargsArgv) { .options({ "origin-host": { type: "string", - describe: "", + describe: "The host of the origin database", }, "origin-port": { type: "number", - describe: "", + describe: "The port number of the origin database", + }, + "origin-scheme": { + type: "string", + describe: + "The scheme used to connect to the origin database - e.g. postgresql or postgres", }, database: { type: "string", + describe: "The name of the database within the origin database", }, "origin-user": { type: "string", + describe: "The username used to connect to the origin database", }, "origin-password": { type: "string", + describe: "The password used to connect to the origin database", }, }) .epilogue(hyperdriveBetaWarning); @@ -53,6 +61,9 @@ export async function handler( if (args.originPort) { database.origin.port = args.originPort; } + if (args.originScheme) { + database.origin.scheme = args.originScheme; + } if (args.database) { database.origin.database = args.database; }