Changes between Initial Version and Version 1 of Ticket #35047
- Timestamp:
- Dec 18, 2023, 5:24:57 AM (11 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #35047 – Description
initial v1 1 1 I had the model: 2 2 3 ```py 3 4 {{{ 4 5 class UserInfo(models.Model): 5 6 user = models.ForeignKey(User, related_name='user_info', on_delete=CASCADE) … … 15 16 16 17 def __str__(self): return str(self.user) 17 ``` 18 }}} 19 18 20 19 21 Then I changed the `usd_per_credit` field to be 20 ``` 22 23 {{{ 21 24 usd_per_credit = models.FloatField(default = 0.00) 22 ``` 25 }}} 26 23 27 24 28 After running `makemigrations` and `migrate`, I ran `sqlmigrate` and got the following: 25 ```sql 29 30 {{{ 26 31 BEGIN; 27 32 -- … … 33 38 ALTER TABLE "accounts_userinfo" ALTER COLUMN "usd_per_credit" DROP DEFAULT; 34 39 COMMIT; 35 ``` 40 }}} 36 41 37 42 The last line before COMMIT is wrong. It drops the default value which was correctly set.