Branch Migrations

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

This path allows access to migrations on a given database branch.

Expected Parameters
NameDescriptionInRequiredSchema
db_branch_nameThe DBBranchName matches the pattern `{db_name}:{branch_name}`. pathstring

Get Branch Migration History

GET  https://{your-workspace-slug}.xata.sh/db/{db_branch_name}/migrations/
Request Body Type Definition
type GetBranchMigrationHistory = {
    limit?: number;
    startFrom?: string;
};
Possible Responses
Status CodeDescriptionExample Response/Type Definition
200OK
type GetBranchMigrationHistory = {
    startedFrom?: StartedFromMetadata;
    migrations?: BranchMigration[];
};

type StartedFromMetadata = {
    branchName: BranchName;
    dbBranchID: string;
    migrationID: string;
};

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[];
};

/**
 * @pattern [a-zA-Z0-9_\-~]+
 */
type BranchName = string;

/**
 * @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;
};

/**
 * @pattern [a-zA-Z0-9_\-~]+
 */
type TableName = string;

type Column = {
    name: string;
    type: "bool" | "int" | "float" | "string" | "text" | "email" | "multiple" | "link" | "object" | "datetime";
    link?: {
        table: string;
    };
    columns?: Column[];
};

type RevLink = {
    linkID: string;
    table: string;
};

type ColumnMigration = {
    old: Column;
    ["new"]: Column;
};
400Bad Request
type GetBranchMigrationHistory = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type GetBranchMigrationHistory = {
    id?: string;
    message: string;
};
5XXUnexpected Error