aerich
aerich copied to clipboard
Adding not null OneToOneRelation (tortoise) not working
Setup:
- Create 2 models and db (postgres)
- init migrations ...
- add a fields.OneToOneRelation(..., null=False) to one of the models
- migrate
- upgrade
Results in: -- upgrade -- ALTER TABLE "table1" ADD "foreign_key" UUID NOT NULL UNIQUE; -- downgrade -- ALTER TABLE "table1" DROP COLUMN "foreign_key";
This however does not enforce the foreign key relationship to table 2! In other words one can add rows with unique random values without errors.