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

Skip to content

fix: upsert coder_app resources in case they are persistent #18509

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
Jun 23, 2025

Conversation

dannykopping
Copy link
Contributor

@dannykopping dannykopping commented Jun 23, 2025

#18487 was merged, meaning coder_app IDs generated by the provider are used to insert into the database.

Consequently:

coder_app resources may be defined as persistent resources (i.e. not defining count = data.coder_workspace.me.start_count) means that the ID for these will not change across workspace builds, therefore we need to upsert instead of insert.


Disclaimer: this change was mostly implemented by Claude Code.

@dannykopping dannykopping marked this pull request as ready for review June 23, 2025 16:53
@dannykopping dannykopping requested review from Emyrk and mafredri June 23, 2025 16:53
_, err := a.Database.InsertWorkspaceApp(ctx, database.InsertWorkspaceAppParams{
ID: uuid.New(),
_, err := a.Database.UpsertWorkspaceApp(ctx, database.UpsertWorkspaceAppParams{
ID: uuid.New(), // TODO: we may need to maintain the app's ID here for stability, but for now we'll leave this as-is.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit: This is a note rather than a todo, or if I'm wrong, consider opening an issue. (Committed todo's are where todo's go to die, etc etc.)

Signed-off-by: Danny Kopping <[email protected]>
@dannykopping dannykopping enabled auto-merge (squash) June 23, 2025 18:40
@dannykopping dannykopping merged commit 4699393 into main Jun 23, 2025
34 checks passed
@dannykopping dannykopping deleted the dk/upsert-app branch June 23, 2025 18:50
@github-actions github-actions bot locked and limited conversation to collaborators Jun 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants