tux icon indicating copy to clipboard operation
tux copied to clipboard

[FEATURE] Tortoise Migration

Open electron271 opened this issue 7 months ago • 0 comments

This will need to be done before 0.1.0

TODO

  • [ ] Uninstall Prisma-related packages.
  • [ ] Refactor models and DB scripts to Tortoise conventions.
  • [ ] Replace all Prisma CRUD/query calls with Tortoise equivalents.
  • [ ] Set up Aerich for database migrations.
  • [ ] Adjust project requirements and documentation.

Packages

Most likely we would be using tortoise-orm[asyncpg] (tortoise with the asyncpg postgres backend) and https://github.com/tortoise/aerich for migrations.

Drawbacks

  • Tortoise is a new project, breaking changes may happen so we need to be cautious
  • Community answers may be lacking (e.g on stackoverflow) due to this

Advantages

  • Good performance Image
  • Fully python
  • Async first

Areas migration will affect:

  • database schemas in tux/prisma will need to be re-written for tortoise, and migrations performed on the database
  • database controllers and associated logic in tux/tux/database
  • Remindme cog directly pulls the Reminder DB model
  • poll cog pulls in the CaseType enum
  • AFK systems directly imports the AFK model
  • snippets use the CaseType enum
  • all moderation cogs pull in CaseType enum
  • moderation cases cog
  • influxdb cog
  • utils/converters.py pulls in from prisma.enums
  • utils/exceptions pulls in prisma.models.Case
  • utils/flags pulls in the CaseType enum
  • probably several more that we'll find during the process

Alternative to #852

electron271 avatar May 05 '25 16:05 electron271