Complete the code to create a new migration file for your Django app.
python manage.py [1] your_app_nameUse makemigrations to create migration files that describe changes to your models.
Complete the command to apply migrations to the production database.
python manage.py [1]The migrate command applies migration files to update the database schema.
Fix the error in the migration command to avoid downtime by running migrations without locking the database.
python manage.py migrate --[1]The --atomic flag runs migrations inside a transaction to avoid partial updates and reduce downtime.
Fill both blanks to create a migration that adds a new field with a default value without locking the table.
class Migration(migrations.Migration): dependencies = [ ('app', '[1]'), ] operations = [ migrations.AddField( model_name='model', name='new_field', field=models.CharField(default='default', max_length=100), [2] ), ]
Use the correct dependency migration name and set preserve_default=False to avoid locking the table when adding a field with a default.
Fill all three blanks to write a safe migration that renames a column without data loss.
class Migration(migrations.Migration): dependencies = [ ('app', '[1]'), ] operations = [ migrations.RenameField( model_name='model', old_name='[2]', new_name='[3]', ), ]
Use the correct dependency migration and specify the old and new field names to rename a column safely.