Skip to content

fix: update the table building #2327

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

fix: update the table building #2327

wants to merge 1 commit into from

Conversation

ozym
Copy link
Contributor

@ozym ozym commented Jan 17, 2025

This fixes some misconfiguration that resulted in some empty tables, it also cleans up the calling mechanism to build the database

@ozym ozym added the bug Something isn't right label Jan 17, 2025
@ozym ozym self-assigned this Jan 17, 2025
@ozym ozym requested review from a team as code owners January 17, 2025 23:11
@@ -125,7 +128,7 @@ CREATE TABLE IF NOT EXISTS preamp (
preamp_id INTEGER PRIMARY KEY NOT NULL,
site_id INTEGER NOT NULL,
subsource TEXT NULL,
scale_factor REAL DEFAULT 1.0 NOT NULL,
scale_factor REAL NOT NULL ON CONFLICT REPLACE DEFAULT 1.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I'm curious as to how this works; normally would expect to see this on the insert/upsert side.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sqlite seems to be a bit odd about how it handles defaults and nulls. Normally if you want the default value you simply don't send anything through for that entry, however this becomes painful for large prepared statements (you would need one for every combination of missing data), the above coding can handle the clash of the not null setting and being sent a null value.

This fixes some misconfiguration that resulted in some empty tables, it also cleans up the calling mechanism to build the database
@ozym ozym requested a review from wilsonjord March 9, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants