klen / peewee_migrate

Simple migration engine for Peewee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How are migrations supposed to be automatically created?

revolter opened this issue · comments

It always creates empty migrate and rollback methods.

It's an issue with --auto flag wich is treated as flag but should be path to module (probaly previous version of click allows that). You need to use --auto-source flag and point to package.

- project_name
  - project_name
    - app
    - models
    - migrations
        - conf.py (contains DATABASE variable imported from models)
  - requirements

In this case, you should use in root dir:

export PYTHONPATH=/home/revolter/project_name/
pw_migrate create --auto --auto-source=project_name --directory=./project_name/migrations initial

If you have problem with imports, you should:

export PYTHONPATH=/home/revolter/project_name/:/home/revolter/project_name/project_name/

Why isn't this in the README!!?