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 Subscription.
The model is as follows:
A User can have many Subscriptions (only one of which will be Active at a time) and each Subscription will be referencing one SubscriptionPack.
How would this be modelled in SQLAlchemy?
Currently I have the User.id and 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.