Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Add instance table along with init code. #1234

Merged
merged 1 commit into from
Mar 6, 2025

Conversation

blkt
Copy link
Contributor

@blkt blkt commented Mar 5, 2025

This change adds an instance table containing the minimum set of details about codegate. We might want to add more details in the future.

The table must contain only a single record at any time. To guarantee that, a trigger is added that prevents inserts beyond the first record.

Finally, code performing the initialization is added to the serve command.

@blkt blkt self-assigned this Mar 5, 2025
@blkt blkt force-pushed the feat/add-instance-details-table-and-init branch 2 times, most recently from 70b2d6e to 6c8e407 Compare March 5, 2025 22:18
SELECT RAISE(FAIL, 'only one instance!');
END;
"""
)
Copy link
Contributor

Choose a reason for hiding this comment

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

could we have a trigger that prevents deletion of the one row as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would avoid adding a constraint on deletion, it becomes cumbersome to modify the table since AFAIK you cannot disable triggers temporarily in sqlite, which means you'd have to rely on DROP TABLE/CREATE TABLE to fix any sort of issue.

Additionally, it's hard to delete that record by mistake since there's no delete_instance routine in DbRecorder and initialization takes care of recreating it.

I'm inclined to let this as is, but I'm not religious about it, we can add it now or later anyway.

JAORMX
JAORMX previously approved these changes Mar 6, 2025
This change adds an `instance` table containing the minimum set of
details about codegate. We might want to add more details in the
future.

The table must contain only a single record at any time. To guarantee
that, a trigger is added that prevents inserts beyond the first
record.

Finally, code performing the initialization is added to the `serve`
command.
@blkt blkt force-pushed the feat/add-instance-details-table-and-init branch from 6c8e407 to dd29ba2 Compare March 6, 2025 09:53
@blkt blkt merged commit fd757dd into main Mar 6, 2025
11 checks passed
@blkt blkt deleted the feat/add-instance-details-table-and-init branch March 6, 2025 11:07
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