mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-02-11 00:47:05 +00:00
Update cheatsheets
This commit is contained in:
29
tldr/sqlx
Normal file
29
tldr/sqlx
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
syntax: markdown
|
||||
tags: [tldr, common]
|
||||
source: https://github.com/tldr-pages/tldr.git
|
||||
---
|
||||
# sqlx
|
||||
|
||||
> Command-line utility for SQLx, the Rust SQL toolkit.
|
||||
> More information: <https://github.com/launchbadge/sqlx/blob/main/sqlx-cli/README.md>.
|
||||
|
||||
- Create the database specified in the DATABASE_URL environment variable:
|
||||
|
||||
`sqlx database create`
|
||||
|
||||
- Drop the specified database:
|
||||
|
||||
`sqlx database drop {{[-D|--database-url]}} {{database_url}}`
|
||||
|
||||
- Create a new pair of up and down migration files with the given description in the "migrations" directory:
|
||||
|
||||
`sqlx migrate add -r {{migration_description}}`
|
||||
|
||||
- Run all pending migrations for the specified database:
|
||||
|
||||
`sqlx migrate run {{[-D|--database-url]}} {{database_url}}`
|
||||
|
||||
- Revert the latest migration for the specified database:
|
||||
|
||||
`sqlx migrate revert {{[-D|--database-url]}} {{database_url}}`
|
||||
Reference in New Issue
Block a user