-
Notifications
You must be signed in to change notification settings - Fork 64
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
Move to SQLite #20
Move to SQLite #20
Conversation
cc @arbaes
Do you think I need to change anything before working on a migration script and merging? |
I can try to look into it tomorrow, but I'll have way more time this weekend ! getting back to you asap |
I think I made a mess during the merge into the sqlite branch. The commands work fine. But when I edit an embed the embed title is not given, and the |
Actually I do not see the code for it in |
It was a much faster fix than I had anticipated. I believe this PR is merge-ready, but I will wait for your comments since a lot of code is changing. ^^ |
I'll promise I'll be testing this tomorrow ! |
No worries, there's no rush :) I will be squashing the commits on merge, I am not bothering to force push right now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, I left a few comments with my opinion on this :)
rldb.py
Outdated
|
||
def commit(self): | ||
db.execute(f"CREATE TABLE '{self.message_id}' ('reaction' NVCARCHAR, 'role_id' INT);") | ||
db.execute(f"INSERT INTO 'channels' ('message_id', 'channel') values('{self.message_id}', '{self.target_channel}');") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating a table for each message seems way too overkill for me. Why not creating a single table for every messages, and another table for the reaction/roles with a foreign key linking them to their message instead ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I should re-implement what id.csv
is doing with foreign IDs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I can do this with only two tables instead of 3 actually. I will push some changes soon.
rldb.py
Outdated
|
||
db.execute("CREATE TABLE IF NOT EXISTS 'channels' ('message_id' INT, 'channel' INT);") | ||
|
||
embeds_creation = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad for that, but maybe "embed" isnt really the right word anymore now :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, pretty weird to keep a global variable if you want to uses classes IMO, but that's just personal preferences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I could use a different word other than embed.
This might sound quite dumb, but how would I access an instance of a class between different steps without a global dict?
Right now to get the instance of the class I'm interested in is by using the key "user_channel" in the dict.
Without a dict wouldn't the bot lose the possibility of managing multiple simultaneous reaction-role messages?
Thanks, I will start working on these. |
I think I fixed all your concerns, bar the global dict. |
I will be merging this branch in a few hours if you don't have anything against it. :) |
Drop CSV in favour of SQLite.
Closes #19