Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Adding currencies and database management in general #15

Open
Ifera opened this issue Mar 21, 2021 · 9 comments
Open

Adding currencies and database management in general #15

Ifera opened this issue Mar 21, 2021 · 9 comments

Comments

@Ifera
Copy link
Member

Ifera commented Mar 21, 2021

So here's the thing. I really don't want people using this plugin to add currencies via commands or via a config. It leads to some problems which I would like to avoid. So for example, servers not being synced with each other and likes. To avoid this I have 3 suggestions,


1) Separate plugin

Arguably, the most easy way to handle currency problems like adding, removing, editing currencies or the editing stuff in the database would be through another plugin.
Additionally for this plugin to work, ParoxityEcon will need to be disabled. This would hopefully avoid the database from getting messed up.
Commands or a config (more favorable) would be used to update the currencies in the database. The plugin, in short, would set the currencies in the database exactly as its set in the config and I don't think commands would be required at all, in this case.

2) Standalone program

A standalone program could be shipped along side the plugin which would allow the user to add, remove, edit currencies or the database (more focused on currencies for now).
The source code would be public and C# would be used for making it.

3) Website

Either a website could be shipped alongside the plugin or Paroxity will provide a platform so for example econ.paroxity.net (not final) which then would connect to the users database and provide the user with the ability to add, remove etc. the currencies and database.
The source code again would be public and how the website would be made is a topic for another debate.


Open for comments, let me know what should be used and why that should be used. Also if you have any other suggestions then don't hesitate to pen them down. I am more in favor of handling this via another plugin due to it being the easiest to do and website being provided in the long run.

@SOF3
Copy link

SOF3 commented Mar 22, 2021

Either a website could be shipped alongside the plugin or Paroxity will provide a platform so for example econ.paroxity.net (not final) which then would connect to the users database and provide the user with the ability to add, remove etc. the currencies and database.

Why not ship the web server with the plugin?

@Ifera
Copy link
Member Author

Ifera commented Mar 22, 2021

Why not ship the web server with the plugin?

Uh, that is what this meant.... Either a website could be shipped alongside the plugin...

@Ifera
Copy link
Member Author

Ifera commented Mar 22, 2021

Also.. Me and @Thunder33345 had a detailed talk on this problem on Dev Union's discord and here is what we agreed on.
A config called init_currencies.yml will be shipped with this plugin. User will define all the currencies he want in that file. Then he will run a command called /pe init currencies. This would firstly remove all the currencies from the database (maybe drop the currency table), set the currencies in the database as defined in the config. Rename the config to init_currencies_TIMESTAMP.yml. This would stop the user from running the command again unless he renames the file. Server would then need to be restarted in order to sync with the database. Also I would like to point out that user will be unable to add currencies on the fly. Also under normal plugin function, currencies will just be read from the database and the plugin would not be writing currencies to the db unless the command stated above was run. Further, another command /pe sync currencies which would create a init_currencies_TIMESTAMP.yml file for the user with all the currencies currently in the database. So if he were to somehow lose the file he used for creating the currencies, he could still get the backup without writing everything again.

@Ifera
Copy link
Member Author

Ifera commented Mar 22, 2021

I don't think that I will go for dropping the table since the currency id would be a foreign key and so if the currency user had previously defined is not present when he synced with the db again via the command, then and only then that currency would be dropped with all other tables having rows containing reference to this currency id removed.

@SOF3
Copy link

SOF3 commented Mar 22, 2021

Why not ship the web server with the plugin?

Uh, that is what this meant.... Either a website could be shipped alongside the plugin...

Could we go further and have it that all other servers must connect to the same master instead of connecting to the database? Then we don't need to worry about concurrency at all.

@Ifera
Copy link
Member Author

Ifera commented Mar 22, 2021

Could we go further and have it that all other servers must connect to the same master instead of connecting to the database? Then we don't need to worry about concurrency at all.

Umm they will be connecting to the same master no?

@SOF3
Copy link

SOF3 commented Mar 23, 2021

Could we go further and have it that all other servers must connect to the same master instead of connecting to the database? Then we don't need to worry about concurrency at all.

Umm they will be connecting to the same master no?

I mean one of the servers is always used as the master, then all other servers always connect to the interface exposed by that server. These other servers will not connect to the database at all.

@Ifera
Copy link
Member Author

Ifera commented Mar 23, 2021

No. All will connect to the database.

@SOF3
Copy link

SOF3 commented Mar 23, 2021

That's what makes things challenging. Having a gate between database and user servers makes things much easier to handle. Plus, that works SQLite too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants