Closed ReS4 closed 4 months ago
Is it possible to exclude some models from migration? For example, the BaseModel?
class PeeweeBaseModel(Model): class Meta: database = Config.web_db class Settings(PeeweeBaseModel): setting_name = CharField(primary_key=True) setting_value = TextField() setting_type = CharField()
I went through the package code, and there is an ignore
argument that you can pass to the Router
class to exclude specific models:
router = Router(Config.web_db, migrate_dir="models/migrations", ignore=["peeweebasemodel"])
This package is great, but it lacks good documentation...
Minor detail for those who don't like raw strings: You can do something like ignore=[models.BaseModel._meta.table_name]
so that when changed, refactored or whatever, the tablename is stable.
Is it possible to exclude some models from migration? For example, the BaseModel?