> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nohead.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema as code

> Keep the project's collections and fields in a file (schema as code)

Every command also takes the [global options](https://docs.nohead.io/cli/commands/global-options.md), such as `--json`.

## `nohead schema pull`

Write the project's schema to a file (default nohead.schema.yaml; - for stdout)

```bash theme={null}
nohead schema pull [options]
```

| Option | |
| - | - |
| `--output <file>` | Where to write it. Default: `nohead.schema.yaml`. |

## `nohead schema diff`

Show what push would change.

```bash theme={null}
nohead schema diff [options] [file]
```

| Argument | |
| - | - |
| `[file]` | Schema file. |

| Option | |
| - | - |
| `--exit-code` | Exit 1 when there are changes. |
| `--no-preview` | Skip dry runs of field migrations. |

## `nohead schema push`

Change the project's schema to match the file (never deletes anything)

```bash theme={null}
nohead schema push [options] [file]
```

| Argument | |
| - | - |
| `[file]` | Schema file. |

| Option | |
| - | - |
| `--yes` | Apply the changes (without it, push only shows them) |
| `--allow-migrations` | Allow type and multiple changes, which rewrite record values. |
| `--clear-invalid` | In migrations, clear values that cannot be converted. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.