Appearance
schema command
The schema command groups together all schema-related commands in the application. At the moment, there's only the inspect subcommand, but more will be added as the CLI improves
| Command | Description |
|---|---|
| inspect | Inspects a live database schema and stores the DDL Statements locally |
inspect command
| Option | Description |
|---|---|
--from <SOURCE> | The connection string of the database to inspect |
--to <TARGET> | The directory to dump the extracted schema |
--exclude <DIRECTORY> | List of glob patterns used to filter resources from applying |
--include <DIRECTORY> | List of glob patterns used to select which resources to inspect |
--silent | Suppress SQL parsing error messages |
Here's how to inspect schema of a running database and write the ddl statements to your local
bash
migrata schema inspect \
--from postgresql://user:pass@host:5432/src_db \
--to ./schemas \
--include "public*"Here's the equivalent config version of this:
yaml
schema:
inspect:
from: postgresql://user:pass@host:5432/src_db
to: ./schemas
include: "public*"You could call this command like this:
bash
migrata config -f ./path/to/inspect.yaml