-
Notifications
You must be signed in to change notification settings - Fork 3
add Raredisease order type to database #4365
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
"""Maps an order type to its allowed applications""" | ||
|
||
__tablename__ = "order_type_application" | ||
order_type = sa.Column(sa.types.Enum(*list(OrderType)), primary_key=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just out of curiosity - the primary key of the OrderTypeApplication table is a composite key over both order type and application. Should order_type be marked as primary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The key is defined as primary in the definition of the store model, so I would say so:
class OrderTypeApplication(Base):
"""Maps an order type to its allowed applications"""
__tablename__ = "order_type_application"
order_type: Mapped[OrderType] = mapped_column(sqlalchemy.Enum(OrderType), primary_key=True)
application_id: Mapped[int] = mapped_column(
ForeignKey("application.id", ondelete="CASCADE"), primary_key=True
)
application: Mapped[Application] = orm.relationship(
"Application", back_populates="order_type_applications"
)
but not sure if I should include the application in the migration model. I assumed not as I don't need it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it works it works! Just surprised me a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it works!
|
Description
Closes #4364
Added
OrderType
Strenumorder_type_application
tableHow to prepare for test
us
paxa
How to test
alembic -c $ALEMBIC_CG_STAGE upgrade 039dbdf8af01
RAREDISEASE
to theorder_type_application
tablealembic -c $ALEMBIC_CG_STAGE downgrade -1 head
Expected test outcome
Review
Thanks for filling in who performed the code review and the test!
This version is a
Implementation Plan