docs: added documentation for db commands (#8846)

* docs: added documentation for db commands

* fix lint errors
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-08-29 10:46:00 +03:00
1 parent c86a9fe864
commit 70f2290a22
18 files changed
+1324 -761

No files matched your search

@@ -0,0 +1,468 @@
---
sidebar_label: "db"
sidebar_position: 5
---
import { Table } from "docs-ui"
export const metadata = {
title: `db Commands - Medusa CLI Reference`,
}
# {metadata.title}
Commands starting with `db:` perform actions on the database.
## db\:setup
Creates a database for the Medusa application with the specified name, if it doesn't exit. Then, it runs migrations and syncs links.
It also updates your `.env` file with the database name.
```bash
npx medusa db:setup --db <name>
```
<Note title="Tip">
Use this command if you're setting up a Medusa project or database manually.
</Note>
### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--db <name>`
</Table.Cell>
<Table.Cell>
The database name.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--skip-links`
</Table.Cell>
<Table.Cell>
Skip syncing links to the database.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Links are synced by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--execute-safe-links`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute only safe actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--execute-all-links`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute all (including unsafe) actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--no-interactive`
</Table.Cell>
<Table.Cell>
Disable the command's prompts.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## db\:create
Creates a database for the Medusa application with the specified name, if it doesn't exit.
It also updates your `.env` file with the database name.
```bash
npx medusa db:create --db <name>
```
<Note title="Tip">
Use this command if you want to only create a database.
</Note>
## Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--db <name>`
</Table.Cell>
<Table.Cell>
The database name.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--no-interactive`
</Table.Cell>
<Table.Cell>
Disable the command's prompts.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## db\:generate
Generate a migration file for the latest changes in one or more modules.
```bash
npx medusa db:generate <module_names...>
```
## Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`module_names`
</Table.Cell>
<Table.Cell>
The name of one or more module (separated by spaces) to generate migrations for. For example, `helloModuleService`.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## db\:migrate
Run the latest migrations to reflect changes on the database, and sync link definitions with the database.
```bash
npx medusa db:migrate
```
<Note title="Tip">
Use this command if you've updated the Medusa packages, or you've created customizations and want to reflect them in the database.
</Note>
### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--skip-links`
</Table.Cell>
<Table.Cell>
Skip syncing links to the database.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Links are synced by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--execute-safe-links`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute only safe actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--execute-all-links`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute all (including unsafe) actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## db\:rollback
Revert the last migrations ran on one or more modules.
```bash
npx medusa db:rollback <module_names...>
```
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`module_names`
</Table.Cell>
<Table.Cell>
The name of one or more module (separated by spaces) to rollback their migrations for. For example, `helloModuleService`.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## db\:sync-links
Sync the database with the link definitions in your application, including the definitions in Medusa's modules.
```bash
npx medusa db:sync-links
```
### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--execute-safe`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute only safe actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--execute-all`
</Table.Cell>
<Table.Cell>
Skip prompts when syncing links and execute all (including unsafe) actions.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
Prompts are shown for unsafe actions, by default.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,66 @@
---
sidebar_label: "develop"
sidebar_position: 2
---
import { Table } from "docs-ui"
export const metadata = {
title: `develop Command - Medusa CLI Reference`,
}
# {metadata.title}
Start Medusa application in development. This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
```bash
npx medusa develop
```
## Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,66 @@
---
sidebar_label: "exec"
sidebar_position: 6
---
import { Table } from "docs-ui"
export const metadata = {
title: `exec Command - Medusa CLI Reference`,
}
# {metadata.title}
Run a custom CLI script. Learn more about it in [this guide](!docs!/advanced-development/custom-cli-scripts).
```bash
npx medusa exec [file] [args...]
```
## Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`file`
</Table.Cell>
<Table.Cell>
The path to the TypeScript or JavaScript file holding the function to execute.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`args`
</Table.Cell>
<Table.Cell>
A list of arguments to pass to the function. These arguments are passed in the `args` property of the function's object parameter.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,198 @@
---
sidebar_label: "new"
sidebar_position: 1
---
import { Table } from "docs-ui"
export const metadata = {
title: `new Command - Medusa CLI Reference`,
}
# {metadata.title}
Create a new Medusa application. Unlike the `create-medusa-app` CLI tool, this command provides more flexibility for experienced Medusa developers in creating and configuring their project.
```bash
medusa new [<dir_name> [<starter_url>]]
```
## Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`dir_name`
</Table.Cell>
<Table.Cell>
The name of the directory to create the Medusa application in.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`starter_url`
</Table.Cell>
<Table.Cell>
The name of the directory to create the Medusa application in.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`https://github.com/medusajs/medusa-starter-default`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
## Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-y`, `--useDefaults`
</Table.Cell>
<Table.Cell>
Skip all prompts, such as databaes prompts. A database might not be created if default PostgreSQL credentials don't work.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--skip-db`
</Table.Cell>
<Table.Cell>
Skip database creation.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--skip-env`
</Table.Cell>
<Table.Cell>
Skip populating `.env`.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-user <user>`
</Table.Cell>
<Table.Cell>
The database user to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-database <database>`
</Table.Cell>
<Table.Cell>
The name of the database used for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-pass <password>`
</Table.Cell>
<Table.Cell>
The database password to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-port <port>`
</Table.Cell>
<Table.Cell>
The database port to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-host <host>`
</Table.Cell>
<Table.Cell>
The database host to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--v2`
</Table.Cell>
<Table.Cell>
Installs Medusa v2, which is still not ready for production.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,85 @@
---
sidebar_label: "start-cluster"
sidebar_position: 7
---
import { Table } from "docs-ui"
export const metadata = {
title: `start-cluster Command - Medusa CLI Reference`,
}
# {metadata.title}
Starts the Medusa application in [cluster mode](https://expressjs.com/en/advanced/best-practice-performance.html#run-your-app-in-a-cluster).
Running in cluster mode significantly improves performance as the workload and tasks are distributed among all available instances instead of a single one.
```bash
npx medusa start-cluster
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-c <number>`, `--cpus <number>`
</Table.Cell>
<Table.Cell>
The number of CPUs that Medusa can consume.
</Table.Cell>
<Table.Cell>
Medusa will try to consume all CPUs.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,66 @@
---
sidebar_label: "start"
sidebar_position: 3
---
import { Table } from "docs-ui"
export const metadata = {
title: `start Command - Medusa CLI Reference`,
}
# {metadata.title}
Start the Medusa application in production.
```bash
npx medusa start
```
## Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,55 @@
---
sidebar_label: "telemetry"
sidebar_position: 8
---
import { Table } from "docs-ui"
export const metadata = {
title: `telemetry Command - Medusa CLI Reference`,
}
# {metadata.title}
Enable or disable the collection of anonymous data usage. If no option is provided, the command enables the collection of anonymous data usage.
```bash
npx medusa telemetry
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--enable`
</Table.Cell>
<Table.Cell>
Enable telemetry (default).
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--disable`
</Table.Cell>
<Table.Cell>
Disable telemetry.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
@@ -0,0 +1,122 @@
---
sidebar_label: "user"
sidebar_position: 4
---
import { Table } from "docs-ui"
export const metadata = {
title: `user Command - Medusa CLI Reference`,
}
# {metadata.title}
Create a new admin user.
```bash
npx medusa user --email <email> [--password <password>]
```
## Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-e <email>`, `--email <email>`
</Table.Cell>
<Table.Cell>
The user's email.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <password>`, `--password <password>`
</Table.Cell>
<Table.Cell>
The user's password.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-i <id>`, `--id <id>`
</Table.Cell>
<Table.Cell>
The user's ID.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
An automatically generated ID.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--invite`
</Table.Cell>
<Table.Cell>
Whether to create an invite instead of a user. When using this option, you don't need to specify a password.
If ran successfully, you'll receive the invite token in the output.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
+3 -710
View File
@@ -1,7 +1,7 @@
import { Table, Prerequisites } from "docs-ui"
import { Table, Prerequisites, ChildDocs } from "docs-ui"
export const metadata = {
title: `Medusa CLI Tool`,
title: `Medusa CLI Reference`,
}
# {metadata.title}
@@ -35,711 +35,4 @@ npx medusa --help
---
## Commands
### new
Create a new Medusa application. Unlike the `create-medusa-app` CLI tool, this command provides more flexibility for experienced Medusa developers in creating and configuring their project.
```bash
medusa new [<dir_name> [<starter_url>]]
```
#### Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`dir_name`
</Table.Cell>
<Table.Cell>
The name of the directory to create the Medusa application in.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`starter_url`
</Table.Cell>
<Table.Cell>
The name of the directory to create the Medusa application in.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`https://github.com/medusajs/medusa-starter-default`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-y`, `--useDefaults`
</Table.Cell>
<Table.Cell>
Skip all prompts, such as databaes prompts. A database might not be created if default PostgreSQL credentials don't work.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--skip-db`
</Table.Cell>
<Table.Cell>
Skip database creation.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--skip-env`
</Table.Cell>
<Table.Cell>
Skip populating `.env`.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-user <user>`
</Table.Cell>
<Table.Cell>
The database user to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-database <database>`
</Table.Cell>
<Table.Cell>
The name of the database used for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-pass <password>`
</Table.Cell>
<Table.Cell>
The database password to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-port <port>`
</Table.Cell>
<Table.Cell>
The database port to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--db-host <host>`
</Table.Cell>
<Table.Cell>
The database host to use for database setup.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--v2`
</Table.Cell>
<Table.Cell>
Installs Medusa v2, which is still not ready for production.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### develop
Start Medusa application in development. This command watches files for any changes, then rebuilds the files and restarts the Medusa application.
```bash
npx medusa develop
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### start
Start the Medusa application in production.
```bash
npx medusa start
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### migrations run
Run the latest migrations to reflect changes on the database.
```bash
npx medusa migrations run
```
### migrations revert
Revert the last migrations ran on one or more modules.
```bash
npx medusa migrations revert <module_names...>
```
#### Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`module_names`
</Table.Cell>
<Table.Cell>
The name of one or more module (separated by spaces) to rever their migrations. For example, `helloModuleService`.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### migrations generate
Generate a migration file for the latest changes in one or more modules.
```bash
npx medusa migrations generate <module_names...>
```
#### Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`module_names`
</Table.Cell>
<Table.Cell>
The name of one or more module (separated by spaces) to generate migrations for. For example, `helloModuleService`.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### links
Manage module links in the database.
```bash
npx medusa links <action>
```
#### Actions
The `links` command receive an action name as an argument.
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Name</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`sync`
</Table.Cell>
<Table.Cell>
Add, update, or delete links based on the definitions in the `src/links` directory of your project.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### user
Create a new admin user.
```bash
npx medusa user --email <email> [--password <password>]
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-e <email>`, `--email <email>`
</Table.Cell>
<Table.Cell>
The user's email.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <password>`, `--password <password>`
</Table.Cell>
<Table.Cell>
The user's password.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-i <id>`, `--id <id>`
</Table.Cell>
<Table.Cell>
The user's ID.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
An automatically generated ID.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--invite`
</Table.Cell>
<Table.Cell>
Whether to create an invite instead of a user. When using this option, you don't need to specify a password.
If ran successfully, you'll receive the invite token in the output.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`false`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### exec
Run a custom CLI script. Learn more about it in [this guide](!docs!/advanced-development/custom-cli-scripts).
```bash
npx medusa exec [file] [args...]
```
#### Arguments
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Argument</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`file`
</Table.Cell>
<Table.Cell>
The path to the TypeScript or JavaScript file holding the function to execute.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`args`
</Table.Cell>
<Table.Cell>
A list of arguments to pass to the function. These arguments are passed in the `args` property of the function's object parameter.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### start-cluster
Starts the Medusa application in [cluster mode](https://expressjs.com/en/advanced/best-practice-performance.html#run-your-app-in-a-cluster). Running in cluster mode significantly improves performance as the workload and tasks are distributed among all available instances instead of a single one.
```bash
npx medusa start-cluster
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`-c <number>`, `--cpus <number>`
</Table.Cell>
<Table.Cell>
The number of CPUs that Medusa can consume.
</Table.Cell>
<Table.Cell>
Medusa will try to consume all CPUs.
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-H <host>`, `--host <host>`
</Table.Cell>
<Table.Cell>
Set host of the Medusa server.
</Table.Cell>
<Table.Cell>
`localhost`
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`-p <port>`, `--port <port>`
</Table.Cell>
<Table.Cell>
Set port of the Medusa server.
</Table.Cell>
<Table.Cell>
`9000`
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### telemetry
Enable or disable the collection of anonymous data usage. If no option is provided, the command enables the collection of anonymous data usage.
```bash
npx medusa telemetry
```
#### Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`--enable`
</Table.Cell>
<Table.Cell>
Enable telemetry (default).
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`--disable`
</Table.Cell>
<Table.Cell>
Disable telemetry.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
<ChildDocs hideItems={["Overview"]} />