tortoise / tortoise/tortoise-orm

How should I change my migration script for production ?

Open
#1,232 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.6k
Forks
516
Avg merge
2d 21h
Merged PRs (30d)
9

Description

I have a migration script to update DB tables which runs fine on a staging environment. As production env contains a ton of tables and running with script would block down entire DB, I'd prefer to find a way to minimize that. Maybe running the code in batches or doing a bulk update/create.

Are there any ways present on Tortoise ORM which could help me in this direction ? If anyone has an example of a similar script, please link them below.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the migration script and production database scenario described in the issue, then inspect the Tortoise ORM migration and bulk-operation entry points. Done requires determining whether batching or bulk update/create can reduce blocking and documenting a concrete production-safe approach or example.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.