# CLI

The CLI has been simplified by removing deployment commands, configuration flags, and starter files. A new migration command has been added to help with database schema upgrades.

## Added

### `mastra migrate` command

A new `mastra migrate` command helps run database migrations when upgrading Mastra versions. This is particularly useful when upgrading from older versions that may have data incompatibilities.

```bash
npx mastra migrate
```

The command bundles your project, connects to your configured storage, and runs any necessary migrations. Currently supports migrating duplicate spans entries that may prevent unique constraint creation.

See the [Storage migration guide](https://mastra.ai/guides/migrations/upgrade-to-v1/storage) for details on when this migration is needed.

## Removed

### `mastra deploy` command

The `mastra deploy` command has been removed from the CLI. This change simplifies the CLI by removing vendor-specific deployment logic.

To migrate, choose one of the [deployment platforms](https://mastra.ai/docs/deployment/overview) of your choice.

### `--env` flag from `mastra build`

The `--env` flag has been removed from the `mastra build` command. This change simplifies the build command.

To migrate, use `mastra start --env <env>` to start the build output with a custom environment.

```diff
- mastra build --env production
+ mastra build
+ mastra start --env production
```

### `--port` flag from `mastra dev`

The `--port` flag has been removed from the `mastra dev` command. Port configuration is now handled through the Mastra instance configuration. This change centralizes port configuration.

To migrate, use `server.port` on the Mastra instance instead of the CLI flag.

```ts
const mastra = new Mastra({
  server: {
    port: 3001,
  },
})
```

### Telemetry options from CLI

The `telemetry` option has been removed from CLI commands including the `--no-telemetry` / `-nt` flag. Telemetry configuration has been removed from the CLI. This change reflects the move of telemetry features to the observability package.

To migrate, remove telemetry flags from CLI commands. Use `@mastra/observability` for tracing features.