Changes between Initial Version and Version 1 of Ticket #32425


Ignore:
Timestamp:
Feb 6, 2021, 10:37:25 AM (4 years ago)
Author:
Jordan Bae
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32425 – Description

    initial v1  
    7979
    8080== **We can see that the same code creates different schemas.**
     81
     82+ when i try to remove the column
     83{{{
     84class PhoneBook(models.Model):
     85    # name = models.CharField(max_length=32, null=True, blank=True, default='jordan')
     86    phone_number = models.CharField(max_length=32, null=True, blank=True)
     87
     88
     89class PhoneBook2(models.Model):
     90    # name = models.CharField(max_length=32, null=True, blank=True, default='jordan')
     91    phone_number = models.CharField(max_length=32, null=True, blank=True)
     92}}}
     93
     94happened like this.
     95{{{
     96In [2]: p=PhoneBook(phone_number='010-1234-1234')                         
     97
     98In [3]: p.save()                                                         
     99INSERT INTO `main_phonebook` (`phone_number`) VALUES (%s) ['010-1234-1234']
     100
     101In [4]: p2=PhoneBook2(phone_number='010-1234-1234')                       
     102
     103In [5]: p2.save()                                                         
     104INSERT INTO `main_phonebook2` (`phone_number`) VALUES (%s) ['010-1234-1234']
     105
     106!!!!!!!!error!!!!!!!!!!!!!!!
     107IntegrityError: (1364, "Field 'name' doesn't have a default value")
     108}}}
Back to Top