I have a Model
class Mystery(models.Model):
first = models.CharField(max_length=256)
second = models.CharField(max_length=256)
third = models.CharFie
This is best accomplished in 3 migrations.
Step 1. Create the new model and allow player to be null: player = models.ForeignKey(Player, null=True)
Step 2. Run ./manage.py schemamigration
Step 3. Run ./manage.py datamigration
Step 4. Update forwards and backwards in
to use whatever logic you like for setting the default player. Ensure that every Mystery
object has a value for player
.
Step 5. Update the Mystery
model so that player
has null=False
.
Step 6. Run ./manage.py schemamigration
Step 7. Run ./manage.py migrate