Query schema history.

https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/schema/history

Query the branch its schema history.

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

Query Schema History.

POST  https://{your-workspace-slug}.{region}.xata.sh/db/db_branch_name/schema/history
Request Body Type Definition
type GetBranchSchemaHistory = {
    page?: {
        /*
         * Query the next page that follow the cursor.
         */
        after?: string;
        /*
         * Query the previous page before the cursor.
         */
        before?: string;
        /*
         * Set page size. If the size is missing it is read from the cursor. If no cursor is given xata will choose the default page size.
         *
         * @default 20
         */
        size?: number;
    };
};
Possible Responses
Status CodeDescriptionExample Response/Type Definition
200OK
type GetBranchSchemaHistory = {
    meta: {
        /*
         * last record id
         */
        cursor: string;
        /*
         * true if more records can be fetch
         */
        more: boolean;
    };
    logs: Commit[];
};

type Commit = {
    title?: string;
    message?: string;
    id: string;
    parentID?: string;
    mergeParentID?: string;
    status: MigrationStatus;
    createdAt: DateTime;
    modifiedAt?: DateTime;
    operations: MigrationOp[];
};

type MigrationStatus = "completed" | "pending" | "failed";

/**
 * @format date-time
 */
type DateTime = string;

/**
 * Branch schema migration operations.
 */
type MigrationOp = MigrationTableOp | MigrationColumnOp;

type MigrationTableOp = {
    addTable: TableOpAdd;
} | {
    removeTable: TableOpRemove;
} | {
    renameTable: TableOpRename;
};

type MigrationColumnOp = {
    addColumn: ColumnOpAdd;
} | {
    removeColumn: ColumnOpRemove;
} | {
    renameColumn: ColumnOpRename;
};

type TableOpAdd = {
    table: string;
};

type TableOpRemove = {
    table: string;
};

type TableOpRename = {
    oldName: string;
    newName: string;
};

type ColumnOpAdd = {
    table: string;
    column: Column;
};

type ColumnOpRemove = {
    table: string;
    column: string;
};

type ColumnOpRename = {
    table: string;
    oldName: string;
    newName: string;
};

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

type ColumnLink = {
    table: string;
};
400Bad Request
type GetBranchSchemaHistory = {
    id?: string;
    message: string;
};
401Authentication Error
{
  "message": "invalid API key"
}
404Example response
type GetBranchSchemaHistory = {
    id?: string;
    message: string;
};
5XXUnexpected Error