The OneTable CLI is a command-line interface tool designed to orchestrate DynamoDB migrations specifically for applications utilizing `dynamodb-onetable` and `onetable-migrate`. Currently at version 1.3.5, it receives frequent minor patch releases for bug fixes and dependency updates, with major feature releases occurring less often to introduce new capabilities like named migrations (v1.3.0). It serves as a crucial utility for development teams to initialize, reset, and evolve DynamoDB schema and data, and for production environments to manage step-wise database upgrades, downgrades, and maintenance tasks. Its key differentiators include supporting reversible, versioned, and named migrations, operating on both local and remote DynamoDB instances, and facilitating the successful evolution of single-table DynamoDB patterns by allowing automated and ordered sequencing of schema changes and data seeding.
npm install onetable-cliVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to install the CLI globally, set up a migration directory with a `migrate.json5` configuration file, initialize the migration system, create a new migration stub, and then run it in dry-run mode before applying it.
Remove `--schema` flags and `schema` properties from your `migrate.json` (or `migrate.json5`). Ensure your migration files define their respective schemas as required by `onetable-migrate`.
Always use the `dir` property in your `migrate.json5` configuration to point to your migration directory. This ensures proper indexing and discovery of all migration types.
Consider deploying the `onetable-controller` solution to remotely host your migrations. Configure your CLI to interact with the remote controller for improved efficiency.
Verify the `name` property in `migrate.json5` matches an existing DynamoDB table. Ensure your AWS credentials (via `AWS_PROFILE` or environment variables) have the necessary permissions to `dynamodb:DescribeTable` and other relevant actions.
Check your `migrate.json5` file. Ensure it's valid JSON5 and contains a top-level `onetable` object with at least a `name` property for your DynamoDB table.
Run `onetable status` to inspect the migration state. Use `onetable up` to apply any outstanding migrations sequentially before attempting specific 'down' or 'goto' commands. If the history is corrupted, you might need to manually inspect or reset it (with caution).