integer
代码语言:javascript复制You are trying to add a non-nullable field 'unique_key' to h1_send_beforeamp without a default; we can't do that (the database needs something to populate existing rows).
Please select a fix:
1) Provide a one-off default now (will be set on all existing rows with a null value for this column)
2) Quit, and let me add a default in models.py
代码语言:javascript复制class amp(BaseModel):
unique_key = models.AutoField(primary_key=True, verbose_name='Primary key')
対策:
追加「auto_created=True, 」
代码语言:javascript复制class amp(BaseModel):
unique_key = models.AutoField(primary_key=True, auto_created=True, verbose_name='Primary key')
char
追加「 default='default value' 」
代码语言:javascript复制str = models.CharField(max_length=20, verbose_name='受注ID', default='')