discord-modmail / modmail

A Modmail bot for Discord. Allowing safe moderator conversations with server members one server at a time.
https://discord-modmail.readthedocs.io/
MIT License
15 stars 8 forks source link

Feature: Database #65

Closed Shivansh-007 closed 2 years ago

Shivansh-007 commented 3 years ago

Closes #55

This PR adds an async PostgreSQL setup with the help of SQLAlchemy and alembic. Alembic is a tool for keeping track of the database migration history and SQLAlchemy(with asyncpg) is a popular ORM tool. The following models have been added to the DB:

  1. Attachments
  2. Configurations
  3. Embeds
  4. Emojis
  5. Messages
  6. Tickets

Where the Embeds and Attachments are foreign keys to the Messages.id column.

TODO

onerandomusername commented 3 years ago

Removed Shivansh as he's busy, @bast0006 is hopefully going to finish this pr.

codecov[bot] commented 3 years ago

Codecov Report

Merging #65 (b2480f8) into main (0ed105f) will decrease coverage by 5.69%. The diff coverage is 8.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #65      +/-   ##
==========================================
- Coverage   38.62%   32.92%   -5.70%     
==========================================
  Files          16       27      +11     
  Lines         769      902     +133     
  Branches      105      110       +5     
==========================================
  Hits          297      297              
- Misses        459      590     +131     
- Partials       13       15       +2     
Impacted Files Coverage Δ
modmail/crud/configurations.py 0.00% <0.00%> (ø)
modmail/crud/messages.py 0.00% <0.00%> (ø)
modmail/crud/threads.py 0.00% <0.00%> (ø)
modmail/models/__init__.py 0.00% <0.00%> (ø)
modmail/models/attachments.py 0.00% <0.00%> (ø)
modmail/models/base.py 0.00% <0.00%> (ø)
modmail/models/configurations.py 0.00% <0.00%> (ø)
modmail/models/embeds.py 0.00% <0.00%> (ø)
modmail/models/emojis.py 0.00% <0.00%> (ø)
modmail/models/messages.py 0.00% <0.00%> (ø)
... and 16 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0ed105f...b2480f8. Read the comment docs.

Shivansh-007 commented 2 years ago

Closing this, as I would be rewriting it using tortoise ORM.