# Schema commands

Dump and apply your Surqlize schema in a Laravel application with the surqlize:schema-dump and surqlize:schema-apply Artisan commands.

The integration adds two Artisan commands for managing your [Surqlize schema](/docs/reference/php/libraries/surqlize/schema.md). Both read the model list from `config('surqlize.models')`.

## Dumping the schema

`surqlize:schema-dump` prints the schema definitions for the configured models without executing them.

```bash
php artisan surqlize:schema-dump
```

Pass `--connection` to indicate which connection the dump is intended for.

```bash
php artisan surqlize:schema-dump --connection=analytics
```

## Applying the schema

`surqlize:schema-apply` runs the schema definitions against the database.

```bash
php artisan surqlize:schema-apply
```

| Option | Description |
|--------|-------------|
| `--dry-run` | Print the schema DDL instead of executing it |
| `--dump` | Alias of `--dry-run` |
| `--connection=` | The SurrealDB connection to apply to |

```bash
php artisan surqlize:schema-apply --dry-run

php artisan surqlize:schema-apply --connection=analytics
```

> [!NOTE]
> Register every model that should take part in schema commands in `config('surqlize.models')`. The commands fail if a configured class does not extend `Surqlize\Model\Model`.

## Learn more

- [Schema](/docs/reference/php/libraries/surqlize/schema.md) for defining tables and fields
- [Configuration](/docs/reference/php/frameworks/laravel/configuration.md#orm-configuration) for the model list
- [Surqlize CLI](/docs/reference/php/libraries/surqlize/code-generation-and-cli.md) for the framework-agnostic commands
