title: Running Django migrations when deploying to Elastic Beanstalk
body: <p>I have my Django app set up on Elastic Beanstalk and recently made a change to the DB that I would like to have applied to the live DB now. I understand that I need to set this up as a container command, and after checking the DB I can see that the migration was run, but I can't figure out how to have more controls over the migration. For example, I only want a migration to run when necessary but from my understanding, the container will run the migration on every deploy assuming the command is still listed in the config file. Also, on occassion, I will be given options during a migration such as:</p>
  
  <pre><code>Any objects realted to these content types by a foreign key will also be deleted.
  Are you sure you want to delete these content types?
  If you're unsure, answer 'no'
  </code></pre>
  
  <p>How do I set up the container command to respond to this with a <code>yes</code> during the deployment phase?</p>
  
  <p>This is my current config file</p>
  
  <pre><code>container_commands:
    01_migrate:
      command: 'source /opt/python/run/venv/bin/actiate &amp;&amp; python app/manage.py makemigrations'
      command: 'source /opt/python/run/venv/bin/activate &amp;&amp; python app/manage.py migrate'
  </code></pre>
  
  <p>Is there a way to set these 2 commands to only run when necessary and to respond to the yes/no options I receive during a migration?</p>