Add tables/ORM classes for streamflow orders and results#73
Add tables/ORM classes for streamflow orders and results#73rod-glover wants to merge 5 commits intomasterfrom
Conversation
|
When reviewing, it might be worth your time to look at tests Otherwise this is pretty straightforward. |
|
Do you have a new ORM diagram? If so, could it be added to this PR? I personally find the diagrams really helpful, hence my continual pestering about them. :) |
There was a problem hiding this comment.
Looks good to me. I appreciate the tests especially. I also ran the upgrade and downgrade on a dockerized database being used by an API, and verified that unsurprisingly, nothing broke.
EDIT: small issue with the downgrade I didn't catch at first, see the comment below.
| ) | ||
|
|
||
|
|
||
| def downgrade(): |
There was a problem hiding this comment.
This downgrade does not cleanly remove the upgrade, because it does not delete the streamflow_order_statuses type. While it's unlikely to be something we need to do, we can't run the upgrade, run the downgrade, and then run the upgrade again without this error message:
sqlalchemy.exc.ProgrammingError: (psycopg2.ProgrammingError) type "streamflow_result_statuses" already exists
[SQL: "CREATE TYPE streamflow_result_statuses AS ENUM ('queued', 'processing', 'error', 'cancelled', 'ready', 'removed')"] (Background on this error at: http://sqlalche.me/e/f405)
Is it possible to delete the type? DROP TYPE or something?
There was a problem hiding this comment.
There was a problem hiding this comment.
Good catch, @corviday !
Hmm. According to SQLAlchemy docs, "The table.drop() call will now emit a DROP TYPE for a table-level enumerated type."
Several things are possible here:
- You're running the tests with a pre-1.1.0 version of SQLAlchemy.
- The ENUM isn't table-level. This seems the likeliest to me, but needs some research.
- The ENUM is table-level, but Alembic is doing something that isn't exactly
table.drop()-- hard to imagine that, but...
eed3340 to
fb7f9d0
Compare
Resolves #72
Tasks: