Skip to content

Migrate to SQLDelight - #20

Draft
antweb wants to merge 43 commits into
masterfrom
sqldelight
Draft

Migrate to SQLDelight#20
antweb wants to merge 43 commits into
masterfrom
sqldelight

Conversation

@antweb

@antweb antweb commented Jan 29, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@antweb
antweb requested a review from raphaelm January 29, 2025 09:14
@antweb
antweb force-pushed the sqldelight branch 2 times, most recently from 5f8fd09 to 21c99b0 Compare September 8, 2025 10:03
Updates the libpretixsync dependency to use the new SQLDelight version
and switches the tests over to run against a Postgres instance instead
of a temporary SQLite DB.

This is required since there is no proper support for mixing database
dialects in SQLDelight yet. As the server runs against Postgres, the
easiest way to deal with this is to run the tests with Postgres as well.
Since the tests now run against a Postgres database and the tables are
not explicitly dropped and the sequences are not reset between test
runs, it is no longer safe to make assumptions about local IDs.
This allows us to have proper typing between the code that build the
requests and the one that parses them.
It is now part of the schema and create through Schema.create().
SQLDelight 2.1.0 added a stricter check for reference cycles in CREATE
statements which now prevents us from setting up addon_to with a foreign
key constraint in the sq file. Instead Postgres implementations must now
run `ALTER TABLE ReceiptLine ADD CONSTRAINT` from code when a new schema
is created.
@raphaelm

Copy link
Copy Markdown
Member

⚠️ Before we merge this, please double-check date types in postgres. libpretixsync seems to be using DATE for all of them, which drops the time component, which is probably not a good idea.

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.

2 participants