cloudflare / cloudflare/developer-platform

🐛 BUG: PRAGMA foreign_key_check; should be allowed for Cloudflare D1 remote and local

Open
#40 0 comments 3 reactions 0 assignees View on GitHub
product:d1
Dominant language
No language data
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

### Which Cloudflare product(s) does this pertain to?

D1

### What version(s) of the tool(s) are you using?

3.49.0 [Wrangler]

### What version of Node are you using?

20.11.0

### What operating system and version are you using?

Mac Sonoma 14.1.1

### Describe the Bug

### Observed behavior
Received a "not authorised" message and migration fails when running a sql file with the following line:
`PRAGMA foreign_key_check;`

### Expected behavior
One should be authorised to be able to run a foreign_key_check

### Steps to reproduce
Just add the above line to an sql file and run a migration either local or remote on a D1 database

### Please provide a link to a minimal reproduction

_No response_

### Please provide any relevant error logs

This is all I see when I receive the error
![image](https://github.com/cloudflare/cf-platform-issues/assets/14161564/00a09402-2670-4516-9923-422c9f6ae297)

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure by adding `PRAGMA foreign_key_check;` to a SQL migration and running it against both local and remote D1. Trace the migration authorization handling for PRAGMA statements; done means the migration runs successfully in both environments without the “not authorised” error.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.