Skip to content

Conversation

@waketzheng
Copy link
Contributor

@waketzheng waketzheng commented Dec 22, 2024

Close #299

TODO

  • Add unittest
  • Update old_models_describe
  • Handle case that change managed=False to managed=True after several migrations
  • Update changelog after v0.8.1 released
  • Merge commits into one

Description

  1. if getattr(MyModel.Meta, 'managed', None) is False, ignore MyModel in migration file
  2. model describe dict will save to the aerich table with a extra "managed": False key value
  3. when change managed from false to true, the model will compared with the last version of "aerich" table's content

Note managed=False does not recognized by tortoise-orm and aerich init-db, it is only for aerich migrate.

@waketzheng waketzheng marked this pull request as draft December 22, 2024 17:57
@waketzheng waketzheng force-pushed the feat-299-support-skip-table branch from e8e9ef6 to 520788c Compare January 22, 2025 10:43
@waketzheng waketzheng force-pushed the feat-299-support-skip-table branch from 8d54989 to a8cb510 Compare February 20, 2025 09:52
@waketzheng waketzheng marked this pull request as ready for review February 20, 2025 09:52
@waketzheng waketzheng changed the title feat: support skip table by setting managed=False feat: support skip table migration by setting managed=False Feb 20, 2025
@waketzheng waketzheng changed the title feat: support skip table migration by setting managed=False feat: support skip table migration by set managed=False Feb 20, 2025
@waketzheng waketzheng merged commit 91adf93 into tortoise:dev Feb 21, 2025
24 checks passed
@waketzheng waketzheng deleted the feat-299-support-skip-table branch February 21, 2025 09:14
@waketzheng waketzheng mentioned this pull request Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to skip certain tables when I migrate database tables

1 participant