How can i makemigrations & migrate in AWS with Django

Viewed 16

I have a question!
I'm trying to change tables (for example> add product.category111 )
my postgresql database in AWS RDS,
but RDS tables weren't changed. And i have NO ERROR...(this makes me going crazy)
I'd tryed almost everything that I can googling but I can't find answer.

First, .ebextensions/10_django.config like this

container_commands:
  01_makemigrations:
    command: "source /var/app/venv/*/bin/activate && python /var/app/current/manage.py makemigrations --noinput"
    leader_only: true
  02_migrate:
    command: "source /var/app/venv/*/bin/activate && python /var/app/current/manage.py migrate --noinput"
    leader_only: true

option_settings:
  aws:elasticbeanstalk:application:environment:
    DJANGO_SETTINGS_MODULE: config.settings.production
  aws:elasticbeanstalk:container:python:
    WSGIPath: config.wsgi:application

Second, config.settings.production.DATABASES

DATABASES = {
        "default": {
            "ENGINE": "django.db.backends.postgresql",
            "HOST": get_secret("AWS_RDS_HOST"),
            "NAME": get_secret("AWS_RDS_NAME"),
            "USER": get_secret("AWS_RDS_USER"),
            "PASSWORD": get_secret("AWS_RDS_PASSWORD"),
            "PORT": "5432",
        }
    }

Third, AWS cfn-init-cmd.log (when i added products.category111 table)

                ...
[INFO]  Migrations for 'products':
[INFO]    /var/app/current/apps/products/migrations/0001_initial.py
[INFO]      - Create model Category
[INFO]      - Create model Category111
                ...
[INFO] Command 02_migrate
[INFO] -----------------------Command Output-----------------------
[INFO]  Operations to perform:
[INFO]    Apply all migrations: "some tables that i made", products
[INFO]  Running migrations:
[INFO]    No migrations to apply.
                ...

as you can see, there is "Create model Category111" in makemigrations section
but "No migrations to apply." in migrate section.
and there is no change in RDS ofc.
Any helps makes me better programmer, Thanks

config command options that I'd tried (all combinations)

01_makemigrations: none, --noinput
02_migrate: none, --noinput, --fake-initial, --run-syncdb --fake"

ps, My project is ignoring products.migrations folder except __init__.py
I found that if I connect direct to AWS instance, after "Do make and migrate" and upload products.migrations like 0001_blabla.py to AWS, it works
Is there any way to without like 0001_blabla.py ?

0 Answers
Related