Migration Execution [deprecated]

https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/migrations/execute

This endpoint is called in the style of an RPC (Remote Procedure Call) when a migration is to be executed against a specific database.

Expected parameters

NameDescriptionInRequiredSchema
db_branch_name

The DBBranchName matches the pattern {db_name}:{branch_name}.

path✅string

Migrate Branch [Deprecated]

POST
https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/migrations/execute

Apply a migration plan to the branch

Request Body Type Definition

type ExecuteBranchMigrationPlan = {
    version: number;
    migration: BranchMigration;
};
 
type BranchMigration = {
    id?: string;
    parentID?: string;
    status: string;
    title?: string;
    lastGitRevision?: string;
    localChanges: boolean;
    createdAt?: DateTime;
    newTables?: {
        [key: string]: Table;
    };
    removedTables?: string[];
    tableMigrations?: {
        [key: string]: TableMigration;
    };
    newTableOrder: string[];
    renamedTables?: TableRename[];
};
 
/**
 * @format date-time
 */
type DateTime = string;
 
type Table = {
    id?: string;
    name: TableName;
    columns: Column[];
    revLinks?: RevLink[];
};
 
type TableMigration = {
    newColumns?: {
        [key: string]: Column;
    };
    removedColumns?: string[];
    modifiedColumns?: ColumnMigration[];
    newColumnOrder: string[];
};
 
/**
 * @example {"newName":"newName","oldName":"oldName"}
 */
type TableRename = {
    /**
     * @minLength 1
     */
    newName: string;
    /**
     * @minLength 1
     */
    oldName: string;
};
 
/**
 * @maxLength 255
 * @minLength 1
 * @pattern [a-zA-Z0-9_\-~]+
 */
type TableName = string;
 
type Column = {
    name: string;
    type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime" | "vector" | "file[]" | "file" | "json";
    link?: ColumnLink;
    vector?: ColumnVector;
    file?: ColumnFile;
    ["file[]"]?: ColumnFile;
    notNull?: boolean;
    defaultValue?: string;
    unique?: boolean;
    columns?: Column[];
};
 
type RevLink = {
    table: string;
    column: string;
};
 
type ColumnMigration = {
    old: Column;
    ["new"]: Column;
};
 
type ColumnLink = {
    table: string;
};
 
type ColumnVector = {
    /**
     * @maximum 10000
     * @minimum 2
     */
    dimension: number;
};
 
type ColumnFile = {
    defaultPublicAccess?: boolean;
};

Responses

type ExecuteBranchMigrationPlan = {
    /**
     * @minLength 1
     */
    migrationID: string;
    parentMigrationID: string;
    status: MigrationStatus;
};
 
type MigrationStatus = "completed" | "pending" | "failed";