i'm getting error when try add new field existing model in django. it's hosted on elastic beanstalk using mysql rds database.
here's error when try access model containing new field:
(1054, "unknown column 'existing_model.new_field' in 'field list'")
is there better way treat migrations in django on eb? here's .config file:
container_commands: 01_makemigrations: command: "source /opt/python/run/venv/bin/activate && python manage.py makemigrations --noinput" leader_only: true 02_migrate: command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput" leader_only: true 03_createsu: command: "source /opt/python/run/venv/bin/activate && python manage.py createsu" leader_only: true 04_collectstatic: command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput" any help? thanks!
turns out had run python manage.py makemigrations locally before eb deploy. way, migration files created , when migrate ran on eb instance, knows how change database accordingly.
my .config file now:
container_commands: 01_migrate: command: "source /opt/python/run/venv/bin/activate && python manage.py migrate --noinput" leader_only: true 02_createsu: command: "source /opt/python/run/venv/bin/activate && python manage.py createsu" leader_only: true 03_collectstatic: command: "source /opt/python/run/venv/bin/activate && python manage.py collectstatic --noinput"
Comments
Post a Comment