You are trying to add a non-nullable field ‘id’ to contact_info without a default

This happens when a different field was marked as primary key with primary_key=True earlier and you are removing that (in case of which django tries to add an id primary key).

That Django is asking for a default value for a primary key seems to be a bug.

To work around this problem, follow these steps:

  1. Supply a random default value when prompted during makemigrations.

  2. Go to the migration file generated (under your_app\migrations\ and delete the default=x,, x being the random value you supplied in step 1.

  3. While you are at the migration file, make sure the order of actions make sense (e.g., remove/alter one primary key before adding another). Save and close.

  4. Migrate as usual.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)