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

fix: avoid insertion key dupls in module_configuration table by upserting on conflict #2107

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

deniseli
Copy link
Contributor

@deniseli deniseli commented Jul 17, 2024

Fixes #2084

This PR addresses the config side, whereas #2105 fixed it for secrets.

I confirmed the test fails before this change but passes with it:

$ go test ./common/configuration/dal/... -run TestModuleConfiguration
debug:migrate: Applying: 20231103205514_init.sql
debug:migrate: Applied: 20231103205514_init.sql in 134.088875ms
debug:migrate: Applying: 20240704103403_create_module_secrets.sql
debug:migrate: Applied: 20240704103403_create_module_secrets.sql in 5.793958ms
--- FAIL: TestModuleConfiguration (0.30s)
    --- FAIL: TestModuleConfiguration/HandlesConflicts (0.00s)
        dal_test.go:108: Did not expect an error but got:
            duplicate key value violates unique constraint "module_configuration_module_name_key": conflict
FAIL
FAIL	github.com/TBD54566975/ftl/common/configuration/dal	0.760s
FAIL
$ go test ./common/configuration/dal/... -run TestModuleConfiguration
ok  	github.com/TBD54566975/ftl/common/configuration/dal	0.775s

@deniseli deniseli marked this pull request as ready for review July 17, 2024 22:46
@deniseli deniseli requested a review from alecthomas as a code owner July 17, 2024 22:46
@deniseli deniseli requested review from a team and matt2e and removed request for a team July 17, 2024 22:46
@ftl-robot ftl-robot mentioned this pull request Jul 17, 2024
@deniseli deniseli merged commit b64f7cf into main Jul 17, 2024
60 checks passed
@deniseli deniseli deleted the dli/config-conflicts branch July 17, 2024 22:52
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.

Updating a secret with --asm will return an error, but appears to work
2 participants