-
Notifications
You must be signed in to change notification settings - Fork 0
CLI Reference
The GCORM CLI is gco.
gco <command> [flags]
Global-style flags accepted by many commands:
--schema <path> Path to a schema directory or file
--config <path> Path to gco.config.yaml or gco.config.yml
Initialize a schema file.
gco init
gco init --yes --provider postgresqlFlags:
--provider <postgresql|mysql|sqlite>--schema-file <path>--env <name>--output <dir>--package <name>--yes--force
Default values:
- Schema file:
schema/schema.gcorm - Environment variable:
DATABASE_URL - Output directory:
./gen - Package:
db - Non-interactive provider:
postgresql
Parse, compile, and validate schema files.
gco validate
gco validate --schema schema
gco validate --config gco.config.yamlFormat schema files.
gco fmt
gco fmt --schema schemaGenerate Go client code from schema files.
gco generate
gco generate --schema schema
gco generate --config gco.config.yaml
gco generate --dry-runFlags:
--schema <path>--config <path>--dry-run
Push schema changes directly to a database.
gco db push
gco db push --schema schema
gco db push --url "$DATABASE_URL"
gco db push --forceFlags:
--schema <path>--config <path>--url <connection-url>--force
Supported providers:
postgresqlmysqlsqlite
See DB Push.
Create migration files from a schema diff.
gco migrate diff --name init
gco migrate diff --name add_posts --schema schema --dir migrationsFlags:
--name <name>--dir <path>--schema <path>--config <path>
Generated files:
up.sqldown.sqlmanifest.json
Generate full initialization SQL from the current schema without creating a migration directory.
gco migrate init-sql --schema schema --output init.sql
gco migrate init-sql --schema schema > init.sqlFlags:
--schema <path>--config <path>-
--output <path>,-o <path>
Create a development migration using the same diff path as migrate diff.
gco migrate dev --name add_postsCurrent behavior: this command generates migration files and prints what would be applied. It does not currently execute SQL against a live database.
Inspect migration directories for deployment.
gco migrate deploy --dir migrationsCurrent behavior: this command reads migration directories and manifests. It does not currently execute SQL against a live database.
Validate and resolve migration state.
gco migrate resolve --applied 20260101_120000_init
gco migrate resolve --rolled-back 20260101_120000_initDetect provider information for an existing database URL.
gco introspect --url "$DATABASE_URL"
gco introspect --url "$DATABASE_URL" --provider postgresql --output schemaCurrent behavior: live full-schema introspection is not implemented in the CLI
command. db push has its own internal database introspection for comparing the
current database schema with the target .gcorm schema.
Print the local CLI version.
gco versionUpgrade the CLI when it was installed by go install.
gco upgradeManual release binary installs must be updated manually from GitHub Releases.
Print command help.
gco help
gco --help
gco -h