Open PythonCoderAS opened 2 years ago
The default is a value or callable?
The default is a string.
It also a problem for JSONB
fields.
some_field = fields.JSONField( default=[], null=False )
produces migration:
ALTER TABLE "some_table" ADD "some_field" JSONB NOT NULL
which causes error:
tortoise.exceptions.IntegrityError: column "some_field" of relation "some_table" contains null values
The correct migration should be:
ALTER TABLE "some_table" ADD "some_field" JSONB NOT NULL DEFAULT '[]';
When I add a default to a column that did not have a default, aerich will not add the default. It will write
ALTER TABLE "<tablename>" ALTER COLUMN "<columnname>" SET;
, which not only does not contain the default but also is a syntax error.