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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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;
    };
    /*
     * Report only migrations that have been added since the given Migration ID.
     */
    since?: string;
};
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;
    checksum: string;
    mergeParentID?: string;
    createdAt: DateTime;
    operations: MigrationOp[];
};

/**
 * @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" | "vector" | "file[]" | "file";
    link?: ColumnLink;
    vector?: ColumnVector;
    file?: ColumnFile;
    ["file[]"]?: ColumnFile;
    notNull?: boolean;
    defaultValue?: string;
    unique?: boolean;
    columns?: Column[];
};

type ColumnLink = {
    table: string;
};

type ColumnVector = {
    /*
     * @maximum 10000
     * @minimum 2
     */
    dimension: number;
};

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