
all() returns a D1Result objectconst { results } = await stmt.all(); to grab just the results propertyconst { results } = await stmt.all();results will be an empty array if there were no results, or null if it doesn't apply (that query doesn't return anything).
npx wrangler d1 execute or npx wrangler d1 migrations apply not authorized to use function: strftimeCURRENT_TIMESTAMP works when using it as the default for a column in the schema, but fails when used in any kind of statement (with a "not authorized")?const results = await stmt.all();
Β Β if (results.length > 0) {const { results } = await stmt.all();
if (results && results.length > 0) {