ObjectStackObjectStack

Migration

Migration protocol schemas

Source: packages/spec/src/system/migration.zod.ts

TypeScript Usage

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

// Validate data
const result = AddFieldOperation.parse(data);

AddFieldOperation

Add a new field to an existing object

Properties

PropertyTypeRequiredDescription
typestring
objectNamestringTarget object name
fieldNamestringName of the field to add
fieldObjectFull field definition to add

DeleteObjectOperation

Delete an existing object

Properties

PropertyTypeRequiredDescription
typestring
objectNamestringName of the object to delete

ExecuteSqlOperation

Execute a raw SQL statement

Properties

PropertyTypeRequiredDescription
typestring
sqlstringRaw SQL statement to execute
descriptionstringoptionalHuman-readable description of the SQL

MigrationDependency

Dependency reference to another migration that must run first

Properties

PropertyTypeRequiredDescription
migrationIdstringID of the migration this depends on
packagestringoptionalPackage that owns the dependency migration

ModifyFieldOperation

Modify properties of an existing field

Properties

PropertyTypeRequiredDescription
typestring
objectNamestringTarget object name
fieldNamestringName of the field to modify
changesRecord<string, any>Partial field definition updates

RemoveFieldOperation

Remove a field from an existing object

Properties

PropertyTypeRequiredDescription
typestring
objectNamestringTarget object name
fieldNamestringName of the field to remove

RenameObjectOperation

Rename an existing object

Properties

PropertyTypeRequiredDescription
typestring
oldNamestringCurrent object name
newNamestringNew object name

On this page