-1
的主键的名字,当我执行命令无法更改认证表
python manage.py makemigrations
结果是
You are trying to add a non-nullable field 'pk_bint_user_id' to appuser 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
我的模型看起来像如下:
class AppUser(AbstractBaseUser):
pk_bint_user_id = models.BigIntegerField(primary_key=True)
email = models.EmailField(
verbose_name='email address',
max_length=255,
unique=True,
)
fk_bint_travel_agency_user_id_or_corporate_user_id= models.BigIntegerField(blank=True,null=True)
chr_travel_agency_user_or_corporate_user =models.CharField('Agency user or Corporate user',max_length=5,blank=True,null=True)
chr_user_type = models.CharField('User type code',max_length=5,blank=True,null=True)
vchr_account_type=models.CharField('Account type',max_length=5,blank=True,null=True)
vchr_account_status=models.CharField('Account status',max_length=5,blank=True,null=True)
objects = MyUserManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = []
class Meta:
db_table='tbl_user'
所有我想定制的主键不同于“ID”的名称,
其实我从头开发应用程序。这里没有表格,我正在进行初始迁移,以便在我的数据库中创建表格。 :( –