retrofit schema create
Create a new oplog and register the schema in retrofit.toml.
<name> schema identifier (SQL-identifier shape).
<location> optional target DIRECTORY (an existing dir, or a
trailing-/ path to be created); the oplog file is
derived as <name>.oplog.
Run with --help-all for the name-charset rules.
Usage:
retrofit schema create <name> [<location>] [flags]
Flags:
--engine-version <15|16|17|18> supported major <15|16|17|18> for the new schema (default: project engine_version)
--form merge the new oplog's form: merge or `compact` (default "merge")
-h, --help help for create
--help-all show extended help (vocabulary, semantics, caveats)
--is-default pin this schema as default_schema
--scope stringArray directory to scope to this schema (repeatable)
Global Flags:
--as string output mode: text | json (default "text")
-C, --chdir string treat <dir> as the working directory for the entire run
--config string retrofit.toml path (overrides discovery; also accepts $RETROFIT_CONFIG)
-f, --file string oplog file path; selects a registered [[schema]] path (overrides discovery)
--no-consolidate render every advisory occurrence instead of collapsing repeats
-q, --quiet count suppress the advisory tier on stderr; stack (-qq) to drop it whole (errors and results still print)
-v, --verbose reveal info-tier advisories on stderr
Docs: https://docs.retrofit.sh/current/commands/retrofit-schema-create/retrofit schema create --help-all adds:
Extended help:
<name> charset rules:
Must match [A-Za-z_][A-Za-z0-9_]* and be 1..63 characters
(SQL-identifier shape: no leading digits, no dashes). A name taken
from a file such as `01_people.sql` fails the leading-digit rule.
The created oplog file lives at <cwd>/<name>.oplog by default.
<location> names the DIRECTORY the oplog should live in; the oplog
file is always derived as <name>.oplog. Pass <location> to control
placement:
- omitted, cwd under the root → <cwd>/<name>.oplog
- omitted, cwd outside it → <project-root>/<name>.oplog
- existing dir or trailing / → <location>/<name>.oplog
- anything else → refused with invalid-location
The resolved target must live under the project root (the directory
holding retrofit.toml), because [[schema]].path is recorded relative
to that root and may not contain `..` segments. With <location>
omitted, running from outside the root (for example at the repo root
against a nested --config) therefore sites the oplog at the project
root rather than in the current directory. An explicit <location> that escapes
the root is still refused with invalid-location; pass a <location>
inside it.
The first `schema create` in a project also sets the registry's
default_schema; subsequent calls preserve the prior pin (use
--is-default to re-pin).