---
title: Migration
description: Migration protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

<Callout type="info">
**Source:** `packages/spec/src/system/migration.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { DeleteObjectOperation, ExecuteSqlOperation, MigrationDependency, ModifyFieldOperation, RemoveFieldOperation, RenameObjectOperation } from '@objectstack/spec/system';
import type { DeleteObjectOperation, ExecuteSqlOperation, MigrationDependency, ModifyFieldOperation, RemoveFieldOperation, RenameObjectOperation } from '@objectstack/spec/system';

// Validate data
const result = DeleteObjectOperation.parse(data);
```

---

## DeleteObjectOperation

Delete an existing object

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ |  |
| **objectName** | `string` | ✅ | Name of the object to delete |


---

## ExecuteSqlOperation

Execute a raw SQL statement

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ |  |
| **sql** | `string` | ✅ | Raw SQL statement to execute |
| **description** | `string` | optional | Human-readable description of the SQL |


---

## MigrationDependency

Dependency reference to another migration that must run first

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **migrationId** | `string` | ✅ | ID of the migration this depends on |
| **package** | `string` | optional | Package that owns the dependency migration |


---

## ModifyFieldOperation

Modify properties of an existing field

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ |  |
| **objectName** | `string` | ✅ | Target object name |
| **fieldName** | `string` | ✅ | Name of the field to modify |
| **changes** | `Record<string, any>` | ✅ | Partial field definition updates |


---

## RemoveFieldOperation

Remove a field from an existing object

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ |  |
| **objectName** | `string` | ✅ | Target object name |
| **fieldName** | `string` | ✅ | Name of the field to remove |


---

## RenameObjectOperation

Rename an existing object

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **type** | `string` | ✅ |  |
| **oldName** | `string` | ✅ | Current object name |
| **newName** | `string` | ✅ | New object name |


---

