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

🐛 BUG: applyD1Migrations fails with output from readD1Migrations if last line of a migration is a comment #7739

Open
bigmac44 opened this issue Jan 12, 2025 · 0 comments
Labels
bug Something that isn't working

Comments

@bigmac44
Copy link

Which Cloudflare product(s) does this pertain to?

Workers Vitest Integration

What versions are you using?

3.101.0

What operating system and version are you using?

Mac Sequoia 15.2

Please provide a link to a minimal reproduction

No response

Describe the Bug

Following the example vitest configuration from:
https://github.com/cloudflare/workers-sdk/blob/d102b60238c1dddfdd829ffee62c451cb526717a/fixtures/vitest-pool-workers-examples/d1/vitest.config.ts

and

https://github.com/cloudflare/workers-sdk/blob/d102b60238c1dddfdd829ffee62c451cb526717a/fixtures/vitest-pool-workers-examples/d1/test/apply-migrations.ts

Will fail if one of the migrations contains a comment as its last line. Given that generating migrations with wrangler will insert a line like:

-- Migration number: 0001 2024-12-30T21:23:40.357Z

It's easy to get a failure if the comment ends up at the bottom of the file.

Failure message is:

Error: D1_ERROR: SQL code did not contain a statement.
    at D1DatabaseSessionAlwaysPrimary._sendOrThrow (cloudflare-internal:d1-api:129:19)
    at D1DatabaseSessionAlwaysPrimary.batch (cloudflare-internal:d1-api:81:23)

Please provide any relevant error logs

No response

@bigmac44 bigmac44 added the bug Something that isn't working label Jan 12, 2025
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jan 12, 2025
@bigmac44 bigmac44 changed the title 🐛 BUG: applyD1Migrations fails with output of readD1Migrations if last line of a migration is a comment 🐛 BUG: applyD1Migrations fails with output from readD1Migrations if last line of a migration is a comment Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working
Projects
Status: Untriaged
Development

No branches or pull requests

1 participant