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

deprecate unused D1 commands/options #7471

Merged
merged 6 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 11 additions & 0 deletions .changeset/major-remove-d1-backups.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"wrangler": major
---

Remove `wrangler d1 backups`

BREAKING CHANGE: This change removes `wrangler d1 backups`, a set of alpha-only commands that would allow folks to interact with backups of their D1 alpha DBs.

For production D1 DBs, you can restore previous versions of your database with `wrangler d1 time-travel` and export it at any time with `wrangler d1 export`.

Closes #7470
9 changes: 9 additions & 0 deletions .changeset/major-remove-d1-deprecated-batch-size.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": major
---

Remove `--batch-size` as an option for `wrangler d1 execute` and `wrangler d1 migrations apply`

BREAKING CHANGE: This change removes the deprecated `--batch-size` flag, as it is no longer necessary to decrease the number of queries wrangler sends to D1.

Closes #7470
11 changes: 11 additions & 0 deletions .changeset/major-remove-d1-migrations-alpha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"wrangler": major
---

Remove alpha support from `wrangler d1 migrations apply`

BREAKING CHANGE: This change removes code that would take a backup of D1 alpha databases before proceeding with applying a migration.

We can remove this code as alpha DBs have not accepted queries in months.

Closes #7470
2 changes: 0 additions & 2 deletions packages/wrangler/src/__tests__/d1/d1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe("d1", () => {
wrangler d1 insights <name> Experimental command. Get information about the queries run on a D1 database.
wrangler d1 create <name> Create D1 database
wrangler d1 delete <name> Delete D1 database
wrangler d1 backup Interact with D1 backups
wrangler d1 execute <database> Execute a command or SQL file
wrangler d1 export <name> Export the contents or schema of your database as a .sql file
wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time
Expand Down Expand Up @@ -58,7 +57,6 @@ describe("d1", () => {
wrangler d1 insights <name> Experimental command. Get information about the queries run on a D1 database.
wrangler d1 create <name> Create D1 database
wrangler d1 delete <name> Delete D1 database
wrangler d1 backup Interact with D1 backups
wrangler d1 execute <database> Execute a command or SQL file
wrangler d1 export <name> Export the contents or schema of your database as a .sql file
wrangler d1 time-travel Use Time Travel to restore, fork or copy a database at a specific point-in-time
Expand Down
21 changes: 5 additions & 16 deletions packages/wrangler/src/__tests__/d1/migrate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ Your database may not be available to serve requests during the migration, conti
});
it("multiple accounts: should let the user apply migrations with an account_id in config", async () => {
setIsTTY(false);
const std = mockConsoleMethods();
msw.use(
http.post(
"*/accounts/:accountId/d1/database/:databaseId/query",
Expand Down Expand Up @@ -154,23 +155,15 @@ Your database may not be available to serve requests during the migration, conti
name: "benchmark3-v1",
num_tables: 2,
uuid: "7b0c1d24-ec57-4179-8663-9b82dafe9277",
version: "alpha",
version: "production",
},
success: true,
errors: [],
messages: [],
},
{ status: 200 }
);
}),
http.post(
"*/accounts/:accountId/d1/database/:databaseId/backup",
async ({ params }) => {
// All we need to do here is check that the right account ID was provided.
expect(params.accountId).toMatchInlineSnapshot(`"nx01"`);
return HttpResponse.error();
}
)
})
);
writeWranglerConfig({
d1_databases: [
Expand Down Expand Up @@ -198,12 +191,8 @@ Ok to create /tmp/my-migrations-go-here?`,
Your database may not be available to serve requests during the migration, continue?`,
result: true,
});

await expect(
runWrangler("d1 migrations apply db --remote")
).rejects.toThrowErrorMatchingInlineSnapshot(
`[TypeError: Failed to fetch]`
);
await runWrangler("d1 migrations apply db --remote");
expect(std.out).toBe("");
});
});

Expand Down
216 changes: 0 additions & 216 deletions packages/wrangler/src/d1/backups.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/wrangler/src/d1/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,6 @@ export function Options(yargs: CommonYargsArgv) {
describe: "Execute commands/files against a preview D1 DB",
type: "boolean",
default: false,
})
.option("batch-size", {
describe: "Number of queries to send in a single batch",
type: "number",
deprecated: true,
hidden: true,
});
}

Expand Down
29 changes: 0 additions & 29 deletions packages/wrangler/src/d1/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as Backups from "./backups";
import * as Create from "./create";
import * as Delete from "./delete";
import * as Execute from "./execute";
Expand Down Expand Up @@ -38,34 +37,6 @@ export function d1(yargs: CommonYargsArgv) {
Delete.Options,
Delete.Handler
)
.command("backup", "Interact with D1 backups", (backupArgs) =>
backupArgs
.demandCommand()
.command(
"list <name>",
"List your D1 backups",
Backups.ListOptions,
Backups.ListHandler
)
.command(
"create <name>",
"Create a new D1 backup",
Backups.CreateOptions,
Backups.CreateHandler
)
.command(
"restore <name> <backup-id>",
"Restore a DB backup",
Backups.RestoreOptions,
Backups.RestoreHandler
)
.command(
"download <name> <backup-id>",
"Download a DB backup",
Backups.DownloadOptions,
Backups.DownloadHandler
)
)
// .command(
// "console <name>",
// "Open a Console on a D1 database",
Expand Down
Loading
Loading