Skip to content
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

Kyesly integration #338

Merged
merged 11 commits into from
Nov 4, 2023
Merged

Conversation

mikefranze
Copy link
Collaborator

Description

Built on #337, will update once that PR is merged to clear this PR up.

This adds the kysely library which is a type safe query builder. I wanted to practice using this library for another project and figured this would help us.

A few notes:

  • Creation of the database tables is now in the new migrations folder. The npm script migrate:latest can be run to update the database to the latest version. It runs migrations in alphabetical order so use the year_month_day date format. We'll want to think about best practices for handling migrations.
  • The library will look at the interfaces to determine how to create queries, so we need to make sure the interface definitions stay in sync with the schemas defined in the migration files.
  • A kysely dev pointed me to a plugin that will automatically stringify any objects when inserting or updating, so we don't have to handle that anymore.
  • The query building API is amazing, makes adding, updating, and reading queries so much easier. It also uses a lot of typescript magic that will prevent you from making a lot of mistakes.

Related Issues

None, just general improvements.

@ArendPeter
Copy link
Member

Now that the previous PR is pushed, can you rebase this one to make the diff cleaner?

@mikefranze
Copy link
Collaborator Author

Now that the previous PR is pushed, can you rebase this one to make the diff cleaner?

@ArendPeter done

Copy link
Member

@ArendPeter ArendPeter left a comment

Choose a reason for hiding this comment

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

Nice! This looks much cleaner!

@mikefranze mikefranze merged commit afb9ba3 into Equal-Vote:main Nov 4, 2023
3 checks passed
@mikefranze mikefranze deleted the kyesly-integration branch December 9, 2023 00:13
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