From f5eeda98ed9ab29e213d45dd1ffef6dbf6e6913f Mon Sep 17 00:00:00 2001 From: Aditya Pandey Date: Thu, 22 Jul 2021 11:21:57 +0530 Subject: [PATCH] Remove docs for db command --- docs/cliCommands.md | 192 -------------------------------------------- 1 file changed, 192 deletions(-) diff --git a/docs/cliCommands.md b/docs/cliCommands.md index 6c8a1d7a..f5306e57 100644 --- a/docs/cliCommands.md +++ b/docs/cliCommands.md @@ -159,198 +159,6 @@ If an error occurs during script execution, any remaining scripts are skipped an yarn redwood dataMigrate up ``` -## db - -Database tools. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -``` -yarn redwood db -``` - -
- - - -| Command | Description | -| :----------------- | :---------------------------------------------------------------------------------------------------- | -| `down [decrement]` | Migrate your database down | -| `generate` | Generate the Prisma client | -| `introspect` | Introspect your database and generate models in `./api/db/schema.prisma`, overwriting existing models | -| `save [name..]` | Create a new migration | -| `seed` | Seed your database with test data | -| `studio` | Start Prisma Studio | -| `up [increment]` | Generate the Prisma client and apply migrations | - -### db down - -Migrate your database down. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db down [decrement] -``` - -
- -| Argument | Description | -| :---------- | :------------------------------------------------------- | -| `decrement` | Number of backwards migrations to apply. Defaults to `1` | - -**Example** - -Given the following migrations, - -```plaintext{2,4} -api/db/migrations/ -├── 20200518160457-create-users <-- desired -├── 20200518160621-add-profiles -├── 20200518160811-add-posts <-- current -└── migrate.lock -``` - -we could get to `20200518160457-create-users` by running: - -```terminal -~/redwood-app$ yarn redwood db down 2 -``` - -### db generate - -Generate the Prisma client. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db generate -``` - -The Prisma client is auto-generated and tailored to your `schema.prisma`. -This means that `yarn redwood db generate` needs to be run after every change to your `schema.prisma` for your Prisma client to be up to date. But you usually won't have to do this manually as other Redwood commands run this behind the scenes. - -### db introspect - -Introspect your database and generate models in `./api/db/schema.prisma`, overwriting existing models. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db introspect -``` - -### db save - -Create a new migration. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db save [name..] -``` - -A migration defines the steps necessary to update your current schema. - -| Argument | Description | -| :------- | :-------------------- | -| `name` | Name of the migration | - -Running `yarn redwood db save` generates the following directories and files as necessary: - -```terminal -api/db/migrations -├── 20200516162516-create-users -│ ├── README.md -│ ├── schema.prisma -│ └── steps.json -└── migrate.lock -``` - -
- -- `migrations`: A directory to store migrations. -- `migrations/`: A directory for a specific migration. The name (``) is composed of a timestamp of when it was created and the name given during `yarn redwood db save`. -- `migrations//README.md`: A human-readable description of the migration, including metadata like when the migration was created and by who, a list of the actual migration changes, and a diff of the changes made to `schema.prisma`. -- `migrations//schema.prisma`: The schema that will be created if the migration is applied. -- `migrations//steps.json`: An alternate representation of the migration steps that will be applied. -- `migrate.lock`: A lock file specifying the current migration. - -### db seed - -Seed your database with test data. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood prisma db seed -``` - -Runs `seed.js` in `./api/db`. `seed.js` instantiates the Prisma client and provides an async main function where you can put any seed data—data that needs to exist for your app to run. See the [example blog's seed.js file](https://github.com/redwoodjs/example-blog/blob/master/api/db/seed.js). - -### db studio - -Start Prisma Studio, a visual editor for your database. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db studio -``` - -### db up - -Generate the Prisma client and apply migrations. - -> **WARNING** -> -> As of `v0.25`, `yarn redwood db ` has been deprecated in favor of `yarn redwood prisma `. Click [here](#prisma) to skip to the prisma section below. - -```terminal -yarn redwood db up [increment] -``` - -
- -| Arguments & Options | Description | -| :------------------ | :------------------------------------------------------------ | -| `increment` | Number of forward migrations to apply. Defaults to the latest | -| `--autoApprove` | Skip interactive approval before migrating | -| `--dbClient` | Generate the Prisma client | -| `--verbose` | Print more | - -**Example** - -Given the following migrations - -```plaintext{2,4} -api/db/migrations/ -├── 20200518160457-create-users <-- current -├── 20200518160621-add-profiles -├── 20200518160811-add-posts <-- desired -└── migrate.lock -``` - -we could get to `20200518160811-add-posts` by running: - -```terminal -~/redwood-app$ yarn redwood db up 2 -``` - ## dev Start development servers for api and web.