Thanks to visit codestin.com
Credit goes to github.com

Skip to content

chore: improve dump error output #3499

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

Merged
merged 2 commits into from
Aug 13, 2022
Merged

chore: improve dump error output #3499

merged 2 commits into from
Aug 13, 2022

Conversation

sreya
Copy link
Collaborator

@sreya sreya commented Aug 13, 2022

This PR surfaces the real error that occurs when attempting to generate a database dump. It also exits immediately if the migration fails, instead of waiting 2 minutes.

E.g.

coder@dev database (jon/fixdump) ✗ go run dump/main.go
panic: migrate db: up: migration failed: syntax error at or near "FOREIGN" (column 2) in line 7: CREATE TABLE IF NOT EXISTS workspace_resource_metadata (
	workspace_resource_id uuid NOT NULL,
	key varchar(1024) NOT NULL,
	value varchar(65536),
	sensitive boolean NOT NULL,
	PRIMARY KEY (workspace_resource_id, key)
	FOREIGN KEY (workspace_resource_id) REFERENCES workspace_resources (id) ON DELETE CASCADE
);
 (details: pq: syntax error at or near "FOREIGN")

goroutine 1 [running]:
main.main()
	/home/coder/go/src/github.com/coder/coder/coderd/database/dump/main.go:19 +0x88c
exit status 2```

sreya added 2 commits August 13, 2022 02:49
- Properly report the error that occurs during the DB connection retry
  loop.
- Move the migration out of the retry loop.
@sreya sreya requested a review from kylecarbs August 13, 2022 03:02
@sreya sreya merged commit 301727d into main Aug 13, 2022
@sreya sreya deleted the jon/fixdump branch August 13, 2022 03:15
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

Successfully merging this pull request may close these issues.

2 participants