Issue
Java, Spring, PostgresDB
I want to set TRUE isActive column in the Subscription table automatically, if the subscriptionStartDate hits the actual date. A scheduled task to check the startDate every subscription every day seems to be little raw solution (but maybe the only). Any better solution?
Solution
You are requesting to mutate the value of a column without explicitly require the database change. This is not supported by PostgresDB/MySQL. With this approach some scheduled task is required.
Although you can take a different approach, when you retrieve the records you can search by subscriptionStartDate <= now()
which will get all subscriptions that are currently active.
Answered By - Nizan Ifrach
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.