I am trying to model the following scenario in Flask SQLAlchemy:
There are a list of
SubscriptionPacks available for purchase. When a particular
User buys a
SubscriptionPack they start an instance of that
The model is as follows:
User can have many
Subscriptions (only one of which will be Active at a time) and each
Subscription will be referencing one
How would this be modelled in SQLAlchemy?
Currently I have the
SubscriptionPack.id referenced as
db.ForeignKey in the
Subscriptions model. And I have
Subscriptions referenced as a
db.Relationship in the
Users table. This seems inconsistent and wrong and is leading me to have to hand-code a lot of SQL statements to return the right results.
Any help as to how to do this right?