Migration Plan [deprecated]

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

This endpoint enables creating a migration plan for a given database branch.

Expected Parameters

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

Compute Migration Plan [Deprecated]

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

Compute a migration plan from a target schema the branch should be migrated too.

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
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
type GetBranchMigrationPlan = Schema;

type Schema = {
    tables: Table[];
    tablesOrder?: string[];
};

type Table = {
    id?: string;
    name: TableName;
    columns: Column[];
    revLinks?: RevLink[];
};

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

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

type ColumnLink = {
    table: string;
};
Status CodeDescriptionExample Response/Type Definition
200Example response
type GetBranchMigrationPlan = {
    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";
    link?: ColumnLink;
    notNull?: boolean;
    defaultValue?: string;
    unique?: boolean;
    columns?: Column[];
};

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

type ColumnMigration = {
    old: Column;
    ["new"]: Column;
};

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