-
Notifications
You must be signed in to change notification settings - Fork 94
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
Issue with migration from deprecating exact_time_int #1218
Comments
Hmm. I was originally going to remove the exact_time_int column and then I didn't in case there were migration troubles. And then I didn't account for this. Probably can & should remove the column now. |
I think |
That would work for sqlite but not for MariaDB(/MySQL probably). |
SQLite doesn’t support POWER(), handle the conversion from exact_time_int in SourcePawn instead. You could fetch the records needing updates, calculate the new times on the server side, and then update the database in a transaction batch. Perform the time update using a safer method. Instead of directly overwriting the time field with calculations from exact_time_int, use MIN(time, calculated_value) to ensure times are not accidentally increased. This ensures that you only update times when the calculated time from exact_time_int is smaller.
Fetch the "id" and "exact_time_int" values where "exact_time_int != 0", perform conversion logic, bla bla you know what to do, then |
Yes it does and the timer isn't using POW/POWER there for sqlite anyway.
that's literally what it already does and what said I would make mysql/mariadb do. Did you just ChatGPT this reply? |
No, I took a look at line 536 of what he linked. Would chat GPT fix stuff like that anyway? |
bhoptimer/addons/sourcemod/scripting/include/shavit/sql-create-tables-and-migrations.sp Line 541 in bac325c
I'm an idiot and misread. Apparently my "an idiot sandwich" steam nickname is correct. |
Note to self: Never touch stuff like this at 4am. The idea was good, but I misread. |
This should be fixed now with e41ba9f for anyone who hits this. |
[rename FillBoxMinMax to BoxPointsToMinsMaxs ](shavitush@f96a574) [probably fix exact_time_int deprecation issue (shavitush#1218) ](shavitush@e41ba9f) [fix bad casts that broke Custom Airaccelerate & Custom Speed Limit zones from](shavitush@ee0fe65)
After the deprecation of exact_time_int, the migration case DeprecateExactTimeInt will reset the player's time to the last value of exact_time_int in the database. This value is not updated anymore in the newer versions and it's fine for all new records that have it assigned to 0. But, it's a problem for the existing records before the deprecation, because if the record is improved on after the deprecration, the exact_time_int value isn't updated anymore.
bhoptimer/addons/sourcemod/scripting/include/shavit/sql-create-tables-and-migrations.sp
Line 536 in bac325c
That line is problematic due to this deprecation, so if you don't backup your database before that's executed (assuming you have records in your database from before the deprecation), then they'll all be set back to the old time and will not reflect the actual record time that's in a replay for example.
The text was updated successfully, but these errors were encountered: