Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alembic #20

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Alembic #20

wants to merge 3 commits into from

Conversation

reginafcompton
Copy link
Contributor

@evz - I corrected the initial alembic migration.

@reginafcompton reginafcompton requested a review from evz August 8, 2017 16:01
@evz
Copy link
Contributor

evz commented Aug 9, 2017

So, I guess the ultimate test for this is to be able to drop your database and run alembic upgrade head and get your database back (without the data, obviously). When I did that, this is what I got:

└─[0] <git:(facets fb17e1e) > alembic upgrade head
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 1fb2df40ef78, Initial data modeling
INFO  [alembic.runtime.migration] Running upgrade 1fb2df40ef78 -> 21c9076fc052, Update person model with nullable email
Traceback (most recent call last):
  File "/home/eric/.virtualenvs/occrp/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/eric/.virtualenvs/occrp/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.ProgrammingError: relation "person" does not exist

It looks like that second migration that it is running is assuming that the person table is there because it's doing:

ALTER TABLE person ALTER COLUMN email DROP NOT NULL

It's probably not super critical to get this totally worked out right away but, eventually.

@evz
Copy link
Contributor

evz commented Aug 9, 2017

Woops, I had the wrong branch checked out 😓

@evz
Copy link
Contributor

evz commented Aug 9, 2017

└─[0] <git:(alembic ea690b6) > alembic upgrade head
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade  -> 1fb2df40ef78, Initial data modeling
Traceback (most recent call last):
  File "/home/eric/.virtualenvs/occrp/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/home/eric/.virtualenvs/occrp/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
psycopg2.ProgrammingError: relation "event_type" does not exist

@reginafcompton
Copy link
Contributor Author

@evz - I added the event_type to the migration. I was able to drop my db and successfully run alembic upgrade head...could you try to do the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants