Changes between Initial Version and Version 1 of Ticket #35047


Ignore:
Timestamp:
Dec 18, 2023, 5:24:57 AM (9 months ago)
Author:
mgoldenbe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #35047 – Description

    initial v1  
    11I had the model:
    22
    3 ```py
     3
     4{{{
    45class UserInfo(models.Model):
    56    user = models.ForeignKey(User, related_name='user_info', on_delete=CASCADE)
     
    1516
    1617    def __str__(self): return str(self.user)
    17 ```
     18}}}
     19
    1820
    1921Then I changed the `usd_per_credit` field to be
    20 ```
     22
     23{{{
    2124    usd_per_credit = models.FloatField(default = 0.00)
    22 ```
     25}}}
     26
    2327
    2428After running `makemigrations` and `migrate`, I ran `sqlmigrate` and got the following:
    25 ```sql
     29
     30{{{
    2631BEGIN;
    2732--
     
    3338ALTER TABLE "accounts_userinfo" ALTER COLUMN "usd_per_credit" DROP DEFAULT;
    3439COMMIT;
    35 ```
     40}}}
    3641
    3742The last line before COMMIT is wrong. It drops the default value which was correctly set.
Back to Top