Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/pgroll cli edit remove xatatype #1461

Draft
wants to merge 153 commits into
base: next
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
153 commits
Select commit Hold shift + click to select a range
c0b679c
Start pre mode
SferaDev Dec 19, 2023
72a64e0
Init version 1.0
SferaDev Dec 19, 2023
e20389d
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
e981c9d
Remove cache implementation (#1368)
SferaDev Feb 13, 2024
b691f7d
Update pgroll spec
SferaDev Feb 27, 2024
cbdd0df
Fix release in next channel
SferaDev Feb 27, 2024
0111c20
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
1872bc7
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
c4b43f4
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
34f1d64
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
6e3484c
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
c19354c
wip
eemmiillyy Apr 2, 2024
3fb9912
wip2
eemmiillyy Apr 3, 2024
4e22aa0
get rid of flatchoices
eemmiillyy Apr 4, 2024
120dbb2
types
eemmiillyy Apr 4, 2024
48acc8b
disable states
eemmiillyy Apr 4, 2024
57e0eab
show links
eemmiillyy Apr 4, 2024
00b1160
column additions
eemmiillyy Apr 4, 2024
38b3f4b
clean
eemmiillyy Apr 4, 2024
9895618
type
eemmiillyy Apr 4, 2024
04a980b
clean
eemmiillyy Apr 4, 2024
325b666
Merge branch 'next' into feat/pgroll-cli-edit
eemmiillyy Apr 4, 2024
90c5c48
packages
eemmiillyy Apr 4, 2024
72ea77f
remove unecessary edits after deletions
eemmiillyy Apr 4, 2024
3e32185
tests and fix editsToMigration
eemmiillyy Apr 5, 2024
c4c29ba
clean
eemmiillyy Apr 5, 2024
3b4144f
send migration
eemmiillyy Apr 5, 2024
34038c3
wip - edit column and add column
eemmiillyy Apr 5, 2024
d8dfa50
wip - column additions
eemmiillyy Apr 5, 2024
2221e03
fix todo
eemmiillyy Apr 5, 2024
3a3c72d
add links
eemmiillyy Apr 8, 2024
f224ec0
improve add column logic
eemmiillyy Apr 8, 2024
342754e
validate add column
eemmiillyy Apr 8, 2024
ba54ac2
fix null and unique validation
eemmiillyy Apr 8, 2024
3cf7631
test
eemmiillyy Apr 8, 2024
e11b8f0
display of non null and unique changes
eemmiillyy Apr 8, 2024
9bcb186
remove restriction on notnull and unsupported and default
eemmiillyy Apr 8, 2024
90f00ac
fix empty deletes after editions
eemmiillyy Apr 8, 2024
14c4029
fix edits to new columns unique and not null not being applied
eemmiillyy Apr 9, 2024
df81474
fix deletions on new columns
eemmiillyy Apr 9, 2024
d254130
warning for source, clean template, remove drop on new tables
eemmiillyy Apr 9, 2024
861b89e
fix unique
eemmiillyy Apr 9, 2024
2d42a30
clean up table name edits
eemmiillyy Apr 9, 2024
5f71054
only create edit if different from original
eemmiillyy Apr 9, 2024
6a4b814
refactor tests
eemmiillyy Apr 9, 2024
78f0a48
clean
eemmiillyy Apr 9, 2024
02962d0
clean
eemmiillyy Apr 9, 2024
fe1e354
Start pre mode
SferaDev Dec 19, 2023
7bf14eb
Init version 1.0
SferaDev Dec 19, 2023
5820148
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
39b47e3
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
de82009
Update pgroll spec
SferaDev Feb 27, 2024
15db951
Fix release in next channel
SferaDev Feb 27, 2024
dc0c6e6
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
67a7bd3
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
36cf0d7
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
ce39e92
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
b0a85c9
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
543ffb6
refactor array to object
eemmiillyy Apr 10, 2024
468fcf0
refactor array to object
eemmiillyy Apr 10, 2024
66225a1
clean
eemmiillyy Apr 10, 2024
cb121f1
clean
eemmiillyy Apr 10, 2024
8702fc9
types
eemmiillyy Apr 10, 2024
8a806a8
clean
eemmiillyy Apr 10, 2024
d5ba013
fix notnull rendering
eemmiillyy Apr 10, 2024
0f83957
more fields
eemmiillyy Apr 10, 2024
8444c56
names and validation
eemmiillyy Apr 11, 2024
6d150bf
Merge branch 'next' into feat/pgroll-cli-edit
eemmiillyy Apr 11, 2024
5f07e65
fix file access prop
eemmiillyy Apr 11, 2024
72fdfe6
fix build
eemmiillyy Apr 11, 2024
32822f0
fix alter
eemmiillyy Apr 11, 2024
68fb0f2
fix alter
eemmiillyy Apr 11, 2024
cbfe6a2
fix tests
eemmiillyy Apr 11, 2024
d1995b2
clean up
eemmiillyy Apr 11, 2024
6a9a2aa
more native types
eemmiillyy Apr 12, 2024
8df42b9
move up one level
eemmiillyy Apr 12, 2024
fed2a06
use original name for combined alter statements
eemmiillyy Apr 12, 2024
cc6f622
Start pre mode
SferaDev Dec 19, 2023
a33e062
Init version 1.0
SferaDev Dec 19, 2023
a0ea12b
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
1495b46
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
1779c52
Update pgroll spec
SferaDev Feb 27, 2024
9cc556c
Fix release in next channel
SferaDev Feb 27, 2024
dfe23ca
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
31e5f84
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
850edd5
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
d1afb7c
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
6c6f3e9
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
2dfa645
Merge branch 'next' into feat/pgroll-cli-edit
eemmiillyy Apr 22, 2024
04dce0b
clean
eemmiillyy Apr 22, 2024
5974a51
Start pre mode
SferaDev Dec 19, 2023
70cb63e
Init version 1.0
SferaDev Dec 19, 2023
ee934a9
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
4e3a0b2
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
f48ef17
Update pgroll spec
SferaDev Feb 27, 2024
c6b870b
Fix release in next channel
SferaDev Feb 27, 2024
6003870
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
c7859c7
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
29587b9
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
f7bd32f
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
5c5370f
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
ab59906
Merge remote-tracking branch 'origin/next' into feat/pgroll-cli-edit
SferaDev Apr 23, 2024
4be38b2
Start pre mode
SferaDev Dec 19, 2023
7a76f07
Init version 1.0
SferaDev Dec 19, 2023
46c5130
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
1dc0454
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
f5238e8
Update pgroll spec
SferaDev Feb 27, 2024
cdab4ca
Fix release in next channel
SferaDev Feb 27, 2024
72dec20
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
3aaec30
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
4af0fa3
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
e1f83c5
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
ecd9952
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
268caeb
Merge remote-tracking branch 'origin/next' into feat/pgroll-cli-edit
SferaDev Apr 23, 2024
804711f
fix name change display
eemmiillyy Apr 24, 2024
6746521
call adapt
eemmiillyy Apr 24, 2024
34b9122
Start pre mode
SferaDev Dec 19, 2023
cc89913
Init version 1.0
SferaDev Dec 19, 2023
0b4d9ad
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
6591758
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
a65b45c
Update pgroll spec
SferaDev Feb 27, 2024
9beb310
Fix release in next channel
SferaDev Feb 27, 2024
e37df40
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
97a7f79
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
99b1ce4
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
4d9958e
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
164c0f2
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
19f29b0
Merge branch 'next' into feat/pgroll-cli-edit
eemmiillyy Apr 29, 2024
0000d8d
Start pre mode
SferaDev Dec 19, 2023
c591169
Init version 1.0
SferaDev Dec 19, 2023
9299b8f
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
04882f5
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
69fe795
Update pgroll spec
SferaDev Feb 27, 2024
37f188b
Fix release in next channel
SferaDev Feb 27, 2024
7a271af
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
9615571
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
eccaaa1
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
3613335
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
620e038
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
929bd35
Merge remote-tracking branch 'origin/next' into feat/pgroll-cli-edit
SferaDev Apr 29, 2024
26027fc
Start pre mode
SferaDev Dec 19, 2023
098a7ee
Init version 1.0
SferaDev Dec 19, 2023
5d550d9
Make XataApiClient to use ES Proxies (#1287)
SferaDev Jan 9, 2024
a2a2374
Remove cache implementation (#1368)
SferaDev Apr 9, 2024
458dc40
Update pgroll spec
SferaDev Feb 27, 2024
05bc977
Fix release in next channel
SferaDev Feb 27, 2024
dcc9b73
Rename internal columns breaking change (#1370)
SferaDev Feb 28, 2024
62f0fea
Update test to allow postgres (#1396)
SferaDev Mar 6, 2024
1a04ca4
Fix drizzle tests in `next` (#1417)
SferaDev Mar 21, 2024
09fff4c
fix: generate data native types (#1412)
eemmiillyy Mar 22, 2024
2c2c59b
Wait for completion on `pgroll` migration push (#1434)
andrew-farries Apr 9, 2024
ffbc2a5
Merge branch 'next' into feat/pgroll-cli-edit
eemmiillyy Apr 29, 2024
7c1cfca
feat: remove xata types from edit
eemmiillyy Apr 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/light-cycles-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@xata.io/client': major
---

Make XataApiClient to use ES Proxies
15 changes: 15 additions & 0 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"mode": "pre",
"tag": "next",
"initialVersions": {
"@xata.io/cli": "0.15.3",
"@xata.io/client": "0.28.2",
"@xata.io/codegen": "0.28.2",
"@xata.io/importer": "1.1.3",
"@xata.io/drizzle": "0.0.13",
"@xata.io/kysely": "0.1.13",
"@xata.io/netlify": "0.1.23",
"@xata.io/plugin-client-opentelemetry": "0.2.37"
},
"changesets": []
}
12 changes: 12 additions & 0 deletions .changeset/violet-worms-develop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
'@xata.io/cli': major
'@xata.io/client': major
'@xata.io/codegen': major
'@xata.io/importer': major
'@xata.io/drizzle': major
'@xata.io/kysely': major
'@xata.io/netlify': major
'@xata.io/plugin-client-opentelemetry': major
---

Version 1.0
2 changes: 0 additions & 2 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ jobs:
cat << EOF > .changeset/force-canary-build.md
---
'@xata.io/plugin-client-opentelemetry': patch
'@xata.io/plugin-client-cloudflare': patch
'@xata.io/plugin-client-cache': patch
'@xata.io/drizzle': patch
'@xata.io/kysely': patch
'@xata.io/pgroll': patch
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: |
npx changeset version
npx changeset publish
npx changeset pre exit
npx changeset version --snapshot next
npx changeset publish --tag next --no-git-tag

- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
Expand Down
2 changes: 1 addition & 1 deletion cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
"relaxed-json": "^1.0.3",
"semver": "^7.6.0",
"text-table": "^0.2.0",
"tslib": "^2.6.2",
"tmp": "^0.2.3",
"tslib": "^2.6.2",
"which": "^4.0.0",
"zod": "^3.23.4"
},
Expand Down
36 changes: 23 additions & 13 deletions cli/src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
message: 'New workspace name'
});
if (!name) return this.error('No workspace name provided');
const workspace = await xata.api.workspaces.createWorkspace({ data: { name } });
const workspace = await xata.api.workspaces.createWorkspace({ body: { name } });
return workspace.id;
} else if (workspaces.workspaces.length === 1) {
const workspace = workspaces.workspaces[0].id;
Expand Down Expand Up @@ -309,7 +309,9 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
options: { allowCreate?: boolean } = {}
): Promise<{ name: string; region: string }> {
const xata = await this.getXataClient();
const { databases: dbs = [] } = await xata.api.database.getDatabaseList({ workspace });
const { databases: dbs = [] } = await xata.api.databases.getDatabaseList({
pathParams: { workspaceId: workspace }
});

if (dbs.length > 0) {
const choices = dbs.map((db) => ({
Expand Down Expand Up @@ -355,7 +357,9 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
} = {}
): Promise<string> {
const xata = await this.getXataClient();
const { branches = [] } = await xata.api.branches.getBranchList({ workspace, region, database });
const { branches = [] } = await xata.api.branch.getBranchList({
pathParams: { workspace, region, dbName: database }
});

const EMPTY_CHOICE = '$empty';
const CREATE_CHOICE = '$create';
Expand Down Expand Up @@ -421,7 +425,7 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
);
if (!name) return this.error('No database name provided');

const { regions } = await xata.api.database.listRegions({ workspace });
const { regions } = await xata.api.databases.listRegions({ pathParams: { workspaceId: workspace } });
const { region } = await this.prompt(
{
type: 'select',
Expand All @@ -434,7 +438,10 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
);
if (!region) return this.error('No region selected');

const result = await xata.api.database.createDatabase({ workspace, database: name, data: { region } });
const result = await xata.api.databases.createDatabase({
pathParams: { workspaceId: workspace, dbName: name },
body: { region }
});

return { name: result.databaseName, region };
}
Expand All @@ -455,9 +462,12 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
});

if (!from) {
await xata.api.branches.createBranch({ workspace, region, database, branch: name });
await xata.api.branch.createBranch({ pathParams: { workspace, region, dbBranchName: `${database}:${name}` } });
} else {
await xata.api.branches.createBranch({ workspace, region, database, branch: name, from });
await xata.api.branch.createBranch({
pathParams: { workspace, region, dbBranchName: `${database}:${name}` },
body: { from }
});
}

return name;
Expand Down Expand Up @@ -566,11 +576,8 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
async deploySchema(workspace: string, region: string, database: string, branch: string, schema: Schemas.Schema) {
const xata = await this.getXataClient();
const compare = await xata.api.migrations.compareBranchWithUserSchema({
workspace,
region,
database,
branch,
schema
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
body: { schema }
});

if (compare.edits.operations.length === 0) {
Expand All @@ -587,7 +594,10 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
});
if (!confirm) return this.exit(1);

await xata.api.migrations.applyBranchSchemaEdit({ workspace, region, database, branch, edits: compare.edits });
await xata.api.migrations.applyBranchSchemaEdit({
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
body: { edits: compare.edits }
});
}
}

Expand Down
5 changes: 4 additions & 1 deletion cli/src/commands/branch/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ export default class BranchCreate extends BaseCommand<typeof BranchCreate> {
const { from } = flags;

try {
const result = await xata.api.branches.createBranch({ workspace, region, database, branch, from });
const result = await xata.api.branch.createBranch({
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
body: { from }
});

if (this.jsonEnabled()) return result;

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/branch/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class BranchDelete extends BaseCommand<typeof BranchDelete> {
if (!confirm) return this.exit(1);
if (confirm !== branch) return this.error('The branch name did not match');

await xata.api.branches.deleteBranch({ workspace, region, database, branch });
await xata.api.branch.deleteBranch({ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` } });

if (this.jsonEnabled()) return {};

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/branch/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class BranchList extends BaseCommand<typeof BranchList> {
const { workspace, region, database } = await this.getParsedDatabaseURL(flags.db);

const xata = await this.getXataClient();
const { branches } = await xata.api.branches.getBranchList({ workspace, region, database });
const { branches } = await xata.api.branch.getBranchList({ pathParams: { workspace, region, dbName: database } });

if (this.jsonEnabled()) return branches;

Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/dbs/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class DatabasesDelete extends BaseCommand<typeof DatabasesDelete>
if (!confirm) return this.exit(1);
if (confirm !== database) return this.error('The database name did not match');

await xata.api.database.deleteDatabase({ workspace, database });
await xata.api.databases.deleteDatabase({ pathParams: { workspaceId: workspace, dbName: database } });

if (this.jsonEnabled()) return {};

Expand Down
4 changes: 3 additions & 1 deletion cli/src/commands/dbs/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ export default class DatabasesList extends BaseCommand<typeof DatabasesList> {
(await this.getWorkspace());

const xata = await this.getXataClient();
const { databases: dbs = [] } = await xata.api.database.getDatabaseList({ workspace });
const { databases: dbs = [] } = await xata.api.databases.getDatabaseList({
pathParams: { workspaceId: workspace }
});

if (this.jsonEnabled()) return dbs;

Expand Down
5 changes: 4 additions & 1 deletion cli/src/commands/dbs/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export default class DatabasesRename extends BaseCommand<typeof DatabasesRename>
if (!confirm) return this.exit(1);
if (confirm !== database) return this.error('The database name did not match');

await xata.api.database.renameDatabase({ workspace, database, newName });
await xata.api.databases.renameDatabase({
pathParams: { workspaceId: workspace, dbName: database },
body: { newName }
});

if (this.jsonEnabled()) return {};

Expand Down
71 changes: 0 additions & 71 deletions cli/src/commands/diff/index.ts

This file was deleted.

14 changes: 8 additions & 6 deletions cli/src/commands/import/csv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,10 @@ export default class ImportCSV extends BaseCommand<typeof ImportCSV> {
{ name: table, columns: columns.filter((c) => c.name !== 'id') }
]
};

const { edits } = await xata.api.migrations.compareBranchWithUserSchema({
workspace,
region,
database,
branch: 'main',
schema: newSchema
pathParams: { workspace, region, dbBranchName: `${database}:main` },
body: { schema: newSchema }
});
if (edits.operations.length > 0) {
const destructiveOperations = edits.operations
Expand Down Expand Up @@ -263,7 +261,11 @@ export default class ImportCSV extends BaseCommand<typeof ImportCSV> {
if (!applyMigrations) {
process.exit(1);
}
await xata.api.migrations.applyBranchSchemaEdit({ workspace, region, database, branch, edits });

await xata.api.migrations.applyBranchSchemaEdit({
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
body: { edits }
});
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cli/src/commands/init/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export default class Init extends BaseCommand<typeof Init> {
if (this.projectConfig?.codegen?.output) {
const { schema: currentSchema } = await (
await this.getXataClient()
).api.branches.getBranchDetails({ workspace, database, region, branch });
).api.branch.getBranchDetails({ pathParams: { workspace, region, dbBranchName: `${database}:${branch}` } });

const hasTables = currentSchema?.tables && currentSchema?.tables.length > 0;
const hasColumns = currentSchema?.tables.some((t) => t.columns.length > 0);
Expand Down Expand Up @@ -434,7 +434,7 @@ export default class Init extends BaseCommand<typeof Init> {
let retries = 0;
while (retries++ < maxRetries) {
try {
await xata.api.branches.getBranchList({ workspace, region, database });
await xata.api.branch.getBranchList({ pathParams: { workspace, region, dbName: database } });
return;
} catch (err) {
if (err instanceof Error && err.message.includes('Invalid API key')) {
Expand Down
20 changes: 8 additions & 12 deletions cli/src/commands/pull/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,18 @@ export default class Pull extends BaseCommand<typeof Pull> {

let logs: Schemas.MigrationHistoryItem[] | Schemas.Commit[] = [];
if (isBranchPgRollEnabled(details)) {
const { migrations } = await xata.api.branches.pgRollMigrationHistory({
workspace,
region,
database,
branch
const { migrations } = await xata.api.migrations.getMigrationHistory({
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` }
});
logs = migrations;
} else {
const data = await xata.api.migrations.getBranchSchemaHistory({
workspace,
region,
database,
branch,
// TODO: Fix pagination in the API to start from last known migration and not from the beginning
// Also paginate until we get all migrations
page: { size: 200 }
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
body: {
// TODO: Fix pagination in the API to start from last known migration and not from the beginning
// Also paginate until we get all migrations
page: { size: 200 }
}
});
logs = data.logs;
}
Expand Down
Loading
Loading