Skip to content

Get request to /dump endoint returns a dump that crahses on import #1983

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

Open
likeon opened this issue Mar 13, 2025 · 0 comments
Open

Get request to /dump endoint returns a dump that crahses on import #1983

likeon opened this issue Mar 13, 2025 · 0 comments

Comments

@likeon
Copy link

likeon commented Mar 13, 2025

Running turso inside a docker container.

Because turso db shell http://localhost:8080/ .dump doesn't create a dump (see libsql-shell-go issue), I tried to get it via /dump http endpoint.

curl -X GET -H "Authorization: Bearer $TURSO_AUTH_TOKEN" "${TURSO_DATABASE_URL%/}/dump" -o "$OUTPUT_FILE"
This successfully fetches a dump file, but an attempt to load it using turso db shell http://localhost:8080 < dump.sql crashes with this error:
Error: SQLite error: no such table: main.map_groups

I assume the crash is happening on this statement:

CREATE TABLE IF NOT EXISTS `levels` (
	`id` integer PRIMARY KEY NOT NULL,
	`map_group_id` integer NOT NULL,
	`name` text NOT NULL,
	FOREIGN KEY (`map_group_id`) REFERENCES `map_groups`(`id`) ON UPDATE no action ON DELETE cascade
);

levels table references map_groups table which appears to be created some time later. Moving map_groups CREATE TABLE above levels fixes the crash.

PRAGMA foreign_keys = OFF; is the first line in the dump. Import into regular sqlite proceeds without errors.

Versions

turso-cli v0.98.1
ghcr.io/tursodatabase/libsql-server:28294c9 (latest atm)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant