-
Notifications
You must be signed in to change notification settings - Fork 252
Increase integer column types to bigint, fix mysql index errors #138
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses database compatibility issues by increasing integer column types to bigint (to properly store Date.now() values) and changing indexed text columns to varchar(4096) for MySQL compatibility. It also adds migration logic for existing databases and refactors the periodic cleanup into a separate function.
Key Changes:
- Changed integer columns storing timestamps to bigint across all tables
- Introduced MySQL-compatible varchar(4096) for indexed text columns
- Added migration logic with
changeIntToBigInt()function to update existing databases
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
65791dc to
1d32ecd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
thanks, ill start reviewing and texting later. just to be sure, can you confirm that varchar(4096) does indeed work on both SQLite, postgres and MySQL? |
|
It's only used for MySQL. Postgres an sqlite continue to use text. |
|
I have tested this PR and can confirm it fixes this bug |
|
After more trial and error, it seems there are still issues with Postgres compatibility |
This might totally be the case, since I've only fixed the most obvious once (namely the ones storing timestamps). |
|
One issue I encountered was on the I also noticed that the UI graph for a site I triggered a few solve requests was not displaying anything, although the count was counting them. Lastly, I think this SQL query is not working because I got |
Can you retest with the changes and let me know if they work for you? |
|
Sure, I'll give it a shot. |
The
integertype in non-SQLite databases is too small to holdDate.now()values.This increases the type to bigint. To deal with existing databases,
alter tablecommands were added. They should simply succeed in case the type already matches (which is the case for newly created databases).This fixes #136.
Also, in MySQL you can't use
textwith indices (unless specifying a prefix length). This is why I've changed the data type tovarchar(4096)for these columns. Note that noalter tableis needed for these, because the creation of the table already fails. The size (4096) is currently arbitrarily chosen and can be set to anything large enough (up to 65,535).