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

Convert Database Id's from integers to UUID's #932

Open
PeachesMLG opened this issue Dec 29, 2024 · 1 comment
Open

Convert Database Id's from integers to UUID's #932

PeachesMLG opened this issue Dec 29, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request low

Comments

@PeachesMLG
Copy link
Member

PeachesMLG commented Dec 29, 2024

We need to convert Database sequential Id's to UUID

This would provide the benifit that at certain places:

https://github.com/Iridium-Development/IridiumSkyblock/blob/master/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java#L731
https://github.com/Iridium-Development/IridiumSkyblock/blob/master/src/main/java/com/iridium/iridiumskyblock/managers/IslandManager.java#L782
https://github.com/Iridium-Development/IridiumSkyblock/blob/master/src/main/java/com/iridium/iridiumskyblock/managers/DatabaseManager.java#L128

We need to save the record in order to create the ID, this creates some lag as it sometimes has to be done syncronously.

converting to UUID means we can do this on runtime without relying on a database save.

Main issue with this is converting the current numerical Id's to a UUID

@PeachesMLG PeachesMLG added bug Something isn't working unconfirmed An issue that needs further investigation labels Dec 29, 2024
@PeachesMLG PeachesMLG assigned sh0inx, PeachesMLG and dlsf and unassigned sh0inx, PeachesMLG and dlsf Dec 29, 2024
@PeachesMLG
Copy link
Member Author

We need a way to attach a schema version to the database, A Metadata table with a db_version which we can read and track.

We can then have a class or something which has an array of functions to run.

if the db_version doesnt exist in the table, check if the id_old column exists on the islands table, if it does set the version to the array.length, if it doesnt set the version to 0

And then run all functions from current_version to max_version, we need to then ensure that each function runs all sql as a transaction + creates backups after each run, and bumps the version

We can then modify the table to something like

ALTER TABLE island RENAME COLUMN Id to Id_old
ALTER TABLE island ADD COLUMN Id TEXT

We then need to generate the Id table to create a UUID, we can potentially do this part in java code? Create a HashMap<int, UUID> to ensure that the same int generates the same UUID?

@PeachesMLG PeachesMLG added enhancement New feature or request medium low and removed bug Something isn't working unconfirmed An issue that needs further investigation medium labels Dec 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low
Projects
None yet
Development

No branches or pull requests

3 participants