-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add GetInboxIDs and use validation service in PublishIdentityUpdates #382
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…o nm/sqlc-experiment
…o nm/sqlc-experiment
…o nm/sqlc-experiment
…o nm/sqlc-experiment
…o nm/sqlc-experiment
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Apr 25, 2024
Merged
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
…de-go into 04-25-add_getaddresslog_sql
Merged
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
Closed
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
neekolas
force-pushed
the
04-24-migrate_first_store_methods_to_sqlc
branch
from
April 25, 2024 19:28
b6a8db2
to
4e985e1
Compare
Base automatically changed from
04-24-migrate_first_store_methods_to_sqlc
to
main
April 25, 2024 20:11
…de-go into 04-25-add_getaddresslog_sql
* Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests
Bun has been bothering me for a while, so I've been working on a migration that will get rid of our ORM altogether and just use boring SQL queries for everything. [`sqlc`](https://sqlc.dev/) is a very slick tool to generate code based on plain SQL queries using placeholders for arguments. It's not perfect...I had to do some gymnastics to make a few of the query types work. But the fact that there is no runtime other than the standard SQL driver and some generated code outweighs its limitations IMO. There's no fancy ORM library to worry about mangling your queries, and the learning curve is basically just "how well do you know SQL". - No support for serializable transactions - The SQL driver is not as well maintained as PGX - High learning curve to build complex queries, even if you know SQL well - Relations system is not very powerful and ends up doing N+1 queries a lot of the time. - Configuring the database with struct tags is errorprone, and there aren't great checks to make sure the struct tags actually match the schema. - I can't find a good way to have dynamic ORDER BY expressions. So I literally have separate queries for ASC and DESC versions. It's not the end of the world, but it's very frustrating. There's an [issue to fix it](sqlc-dev/sqlc#2061), and some hacky workarounds using CASE statements, but it's not great. - Making the filters play nice with `json_populate_recordset` is a bit of a pain. Switching to the `pgx` driver helped, since I think there was a bug in Bun's pgdriver. We use Bun in a lot of places and for a lot of things today. - It powers the `authz` database and all the migrations there - It powers the migrations for the `message` database (but not the queries) - It powers the `mls` database and all the queries in the `mlsstore`. The priority right now is to remove it from the `mlsstore`. We will still use it for migrations (`sqlc` can read Bun migrations just fine). This involves replacing the bun `pgdriver` with `pgx` (done in this PR) and replacing all the Bun ORM queries with `sqlc` queries. I have most of the queries written, but I'll split up the actual migration over several PRs. This can be done incrementally, but once the process is complete we can delete the Bun models. We aren't using any of the fancy `sqlc` cloud features and have no plans to. Ummmm. 😬. That was me.
* Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests
…de-go into 04-25-add_getaddresslog_sql
…m:xmtp/xmtp-node-go into 04-24-migrate_first_store_methods_to_sqlc
* Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests
* Add insertlog query * validation service * insert log * revocation for removed members * lint * remove unnecessary log * change test to use query from sqlc * remove comments * fix tests
…de-go into 04-25-add_getaddresslog_sql
neekolas
changed the title
WIP Add GetAddressLog SQL
Add GetInboxIDs and use validation service in PublishIdentityUpdates
Apr 25, 2024
insipx
approved these changes
Apr 25, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
tl;dr
PublishIdentityUpdates
flow for new and revoked members