I have an application which is in BETA mode. The model of this app has some classes with an explicit primary_key. As a consequence Django use the fields and doesn\'t create
I would like to share my case: The column email was the primary key, but now that's wrong. I need to change the primary key to another column. After trying some suggestions, I finally came up with the most simple solution:
primary_key=True on email column by blank=True, null=Truemakemigrations to create a new migration file and edit it like this:class Migration(migrations.Migration):
dependencies = [
('api', '0026_auto_20200619_0808'),
]
operations = [
migrations.RunSQL("ALTER TABLE api_youth DROP CONSTRAINT api_youth_pkey"),
migrations.AlterField(
model_name='youth', name='email',
field=models.CharField(blank=True, max_length=200, null=True))
]