tux icon indicating copy to clipboard operation
tux copied to clipboard

Tortoise Migration

Open electron271 opened this issue 7 months ago • 4 comments

TODO

  • [x] Uninstall Prisma-related packages and install Tortoise 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.

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

closes #843

Summary by Sourcery

Switch the project's ORM from Prisma to Tortoise, updating dependencies and documentation accordingly.

New Features:

  • Add Tortoise ORM as the project's database ORM.

Enhancements:

  • Remove Prisma ORM and its dependencies from the project.

Documentation:

  • Update documentation to reference Tortoise ORM instead of Prisma.

electron271 avatar May 11 '25 20:05 electron271

Reviewer's Guide

This pull request initiates the migration from Prisma to Tortoise ORM by updating project dependencies and documentation references, laying the groundwork for further codebase refactoring.

File-Level Changes

Change Details Files
Replaced Prisma ORM with Tortoise ORM in project dependencies and documentation.
  • Removed 'prisma' from project dependencies in pyproject.toml.
  • Added 'tortoise-orm' (with asyncpg extra) to project dependencies in pyproject.toml.
  • Updated ORM reference from Prisma to Tortoise in README.md.
pyproject.toml
README.md
Updated poetry.lock to reflect dependency changes.
  • Regenerated poetry.lock to remove Prisma and add Tortoise ORM dependencies.
poetry.lock

Assessment against linked issues

Issue Objective Addressed Explanation
#843 Uninstall Prisma-related packages.
#843 Install Tortoise packages.
#843 Adjust project requirements and documentation to reflect the change from Prisma to Tortoise.

Possibly linked issues

  • #843: PR uninstalls Prisma and installs Tortoise, the initial step for the migration proposed in issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an issue from a review comment by replying to it. You can also reply to a review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull request title to generate a title at any time. You can also comment @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment @sourcery-ai summary on the pull request to (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

  • Contact our support team for questions or feedback.
  • Visit our documentation for detailed guides and information.
  • Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.

sourcery-ai[bot] avatar May 11 '25 20:05 sourcery-ai[bot]

Deploying tux with  Cloudflare Pages  Cloudflare Pages

Latest commit: b535717
Status: ✅  Deploy successful!
Preview URL: https://d2db30fb.tux-afh.pages.dev
Branch Preview URL: https://tortoise.tux-afh.pages.dev

View logs

@sourcery-ai dismiss

electron271 avatar May 11 '25 21:05 electron271

⏱️ 7m total CI duration on this PR

Job Cumulative Duration Recent Runs
Analyze (python) 2m 🟩🟩
pyright 2m 🟥🟥🟥
docker 1m 🟥
Ruff 1m 🟩🟩🟩
Analyze (actions) 51s 🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

trunk-io[bot] avatar May 12 '25 00:05 trunk-io[bot]

Given that tortoise does not fully meet our requirements for the project, can we fully close this pr, and then re-open down the line if needed?

anemoijereja-eden avatar Jun 21 '25 23:06 anemoijereja-eden

@anemoijereja-eden yep, closed

electron271 avatar Jun 22 '25 02:06 electron271