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

refactor: Simplify database features to reduce complexity #28

Open
VikashKothary opened this issue Jun 17, 2022 · 3 comments
Open

refactor: Simplify database features to reduce complexity #28

VikashKothary opened this issue Jun 17, 2022 · 3 comments

Comments

@VikashKothary
Copy link
Member

VikashKothary commented Jun 17, 2022

Combine PostgreSQL and MariaDB features

The code in the settings knows that the server can support both postgresql and mariadb. The same is true with the requirements.txt files.

We can reduce the complexity of the codebase by making the features database agnostic. The goal is to have a single database (most likely PostgreSQL) as the default database. But to allow users to switch in a MariaDB/MySQL database by modifying the config.

This is technically what the codebase is doing by it treats both databases as first-class citizens which is unnecessarily bloating the codebase.

Combine multiple databases

It might be worth combining the userdb and the maindb so the application only needs a single database by default.

It will probably be useful to support the existing environment variables for backward-compatibility. But my gut tells me it won't be used by most our users, so having a single database configuration should lower the barrier-to-entry for new users, thus improve the adoption of the server.

@VikashKothary
Copy link
Member Author

VikashKothary commented Jun 17, 2022

@AntonOfTheWoods What was the inspiration behind separating the 'maindb' and the 'userdb'?
I assume it's just to keep the Anki Sync and Django data separate?

@AntonOfTheWoods
Copy link
Contributor

@VikashKothary , yes. userdbs are done as postgres schemas and mysql dbs if memory serves. The idea was to keep the django side of things separate from userdata.

@VikashKothary
Copy link
Member Author

VikashKothary commented Jun 29, 2022

That sounds good. I'm planning on refactoring it so that the internal state of this service in the database isn't influenced by the Anki database structure, so we might be able to eliminate the complexity.

I think the Anki database structures suffer from very poor column names so I hope if we can improve this, it would improve the developer experience and reduce the complexity of the service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants