我有和现有的数据库,我有models.py如下:
class basicData(models.Model):
companyId = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
companyName = models.CharField(max_length=1000,null=True)
emailIdCompany = models.EmailField(max_length=1000,blank=False,null=True)
numberOfEmployees = models.CharField(max_length=1000,null=True)
contactNumberCompany = models.CharField(max_length=1000,null=True)
class extraData(models.Model):
companyId = models.UUIDField(default=uuid.uuid4, editable=False)
interaction = JSONField(db_index=True,null=True)
我想更新models.py,如下所示:
class basicData(models.Model):
companyId = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
companyName = models.CharField(max_length=1000,null=True)
emailIdCompany = models.EmailField(max_length=1000,blank=False,null=True)
numberOfEmployees = models.CharField(max_length=1000,null=True)
contactNumberCompany = models.CharField(max_length=1000,null=True)
class extraData(models.Model):
companyId = models.ForeignKey(globalcompaniesbasicdatabase)
interaction = JSONField(db_index=True,null=True)
如何在不丢失数据的情况下执行此操作。