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

Clarify that wrangler d1 execute defaults to remote DB #4202

Merged
Merged
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: 9 additions & 2 deletions packages/wrangler/src/d1/execute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@
const persistencePath = getLocalPersistencePath(persistTo, config.configPath);
const d1Persist = path.join(persistencePath, "v3", "d1");

logger.log(`🌀 Loading ${id} from ${readableRelative(d1Persist)}`);
logger.log(

Check warning on line 239 in packages/wrangler/src/d1/execute.tsx

View check run for this annotation

Codecov / codecov/patch

packages/wrangler/src/d1/execute.tsx#L239

Added line #L239 was not covered by tests
`🌀 Executing on local database ${name} (${id}) from ${readableRelative(
d1Persist
)}:`
);

const mf = new Miniflare({
modules: true,
Expand Down Expand Up @@ -313,7 +317,10 @@
);
}
const dbUuid = preview ? db.previewDatabaseUuid : db.uuid;
logger.log(`🌀 Executing on ${name} (${dbUuid}):`);
logger.log(`🌀 Executing on remote database ${name} (${dbUuid}):`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe (for both):

To execute on your local development database, pass the --local flag to 'wrangler d1 execute'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elithrar I added this extra line to the remote call. I thought it was a little verbose, but it should be useful for the option which is the default.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me!

logger.log(
"🌀 To execute on your local development database, pass the --local flag to 'wrangler d1 execute'"
);

const results: QueryResult[] = [];
for (const sql of batches) {
Expand Down
Loading