Reputation: 596
I have an already migrated Django model, which was created this way:
operations = [
migrations.CreateModel(
name='Victim',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=200)),
('instagram', models.CharField(max_length=254)),
('old_password', models.CharField(blank=True, max_length=200)),
('new_password', models.CharField(blank=True, max_length=200)),
],
),
]
But now, I want to make email and instagram attribute Blank=True
, but password fields make Blank=False
.
What is the easiest way to do this: delete and recreate the model (data is not important) or is there a possible way to do this?
Upvotes: 1
Views: 50
Reputation: 34922
You can still change your models and run manage.py makemigrations
. It will create another migration to execute the required SQL statements to alter your database schema when running manage.py migrate
. This is the role of migrations.
Upvotes: 1