frc5183 / Oatmeal

MIT License
2 stars 0 forks source link

Complete Database Integration #4

Closed Trip-kun closed 1 year ago

Trip-kun commented 1 year ago

The storable system is deprecated and is being replaced with the Entity system that uses MariaDB to store data. Both GuildStorable and UserStorable have already been Replaced. MemberStorable and ChannelStorable still need to be. This will involve integrating both MemberEntity and ChannelEntity into the EntityManager system and retrofitting them into all usages of MemberStorable and ChannelStorable.

I will likely take on this task.

RED-M0CKING-LINE commented 1 year ago

Also a note to this: we should have two database systems to pick from. One local, and one remote MariaDB fulfills the remote option the local option could be SQLite or XML or a variety of things but modularity should be kept in mind to make it easier to put in the option, without needing to refactor entire classes.

Trip-kun commented 1 year ago

I mean if we want a local system, as you say XML then files could be fine. We already have a file based system, we could look into merging Storables and Entities possibly using abstract classes, then providing an option in the config to choose between them.

(Info: Storables use JSON based representation of the data structures and store it in files. The location of these files should also be a config option if this is what we want)

Baconing commented 1 year ago

ORMLite has the ability to use SQLite however im not sure how easy it would be to do both of them at the same time.

We would have to have 2 connection sources and therefore a way to proioritize one and/or pull/put data from both of them.

Not sure what the point of having a local and remote system is tho, but if it's testing or backups, you can replicate MariaDB databases to a seperate database to always have up-to-date testing data or backups.

Trip-kun commented 1 year ago

The idea isn't to have two different systems concurrently, but rather just a "use this or that" system for different options for any user to choose. So for our prod we will probably continue using mariadb, but we'll keep the json storable system and integrate it so it's just a config setting to switch between them (say, JSON is much easier for a testing environment, mariadb is more appropriate for prod)

RED-M0CKING-LINE commented 1 year ago

Migrating the current file system based implementation sounds great. But yeah, the implementation would have a common interface that would translate the function calls to which ever system is in use at that time. The interface would handle everything to do with the storage system, whereas the rest of the program would only have to worry about processing the data, which should be provided in standard form, regardless of interface.

Trip-kun commented 1 year ago

Complete by 999a90f