Skip to content

Conversation

@jakubno
Copy link
Member

@jakubno jakubno commented Sep 9, 2025

Note

Switch snapshot creation to a new sqlc UpsertSnapshot and update orchestrator to use it, with added tests and removal of legacy Ent-based code.

  • Database (sqlc):
    • UpsertSnapshot: Add SQL and generated code to upsert snapshots and create corresponding env_builds (packages/db/queries/snapshots/create_new_snapshot.sql, generated create_new_snapshot.sql.go).
    • Tests: Add upsert_snapshot_test.go covering new, existing, and repeated upserts; include raw SQL test helpers in packages/db/client/tests.go.
  • Orchestrator:
    • Update pause_instance.go to call sqlcDB.UpsertSnapshot, pass structured params, and use returned template_id/build_id for snapshotting and status update.
  • Cleanup:
    • Remove legacy Ent-based snapshot creation (SnapshotInfo, NewSnapshotBuild) from packages/shared/pkg/db/snapshot.go.

Written by Cursor Bugbot for commit fbd8432. This will update automatically on new commits. Configure here.

@jakubno jakubno added the improvement Improvement for current functionality label Sep 9, 2025
@jakubno jakubno self-assigned this Sep 9, 2025
@jakubno jakubno force-pushed the refactor-template-build-cache-to-use-sqlc branch from ae8f5f8 to 6cc139b Compare September 9, 2025 17:34
Base automatically changed from refactor-template-build-cache-to-use-sqlc to main September 10, 2025 06:17
@jakubno jakubno force-pushed the refactor-snapshot-to-sqlc branch 4 times, most recently from b147684 to 698ecf7 Compare September 16, 2025 07:46
@ValentaTomas
Copy link
Member

@jakubno, is this PR just a reference for the SQLC rewrite?

@ValentaTomas ValentaTomas changed the title [WIP] Refactor snapshot to sqlc Refactor snapshot to sqlc Oct 27, 2025
@jakubno
Copy link
Member Author

jakubno commented Oct 29, 2025

I will be returning to this very soon

@jakubno jakubno force-pushed the refactor-snapshot-to-sqlc branch from 0ff4d46 to 4f8922e Compare November 18, 2025 19:29
@jakubno jakubno marked this pull request as ready for review November 18, 2025 20:21
@sitole sitole self-requested a review November 19, 2025 10:16
@jakubno jakubno force-pushed the refactor-snapshot-to-sqlc branch from 719d6a2 to 7ce2e34 Compare November 19, 2025 13:47
Comment on lines 42 to 46
metadata = @metadata,
sandbox_started_at = @started_at,
origin_node_id = @origin_node_id,
auto_pause = @auto_pause,
config = @config
Copy link
Member

Choose a reason for hiding this comment

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

You can use metadata = excluded.metadata here instead of putting the value here again.

Copy link
Member

@sitole sitole left a comment

Choose a reason for hiding this comment

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

image

@jakubno jakubno enabled auto-merge (squash) November 19, 2025 16:33
@jakubno jakubno merged commit 8b5f5d0 into main Nov 19, 2025
27 checks passed
@jakubno jakubno deleted the refactor-snapshot-to-sqlc branch November 19, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement for current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants