I build a website with different plans, where users can have in Basic plan 10 posts and in Premium 20. Now I think about, what is the best way, when user downgrade from premium to basic and have for example 20 created posts.
Should I delete all posts (from 11-20) after the date of downgrade?
Should I soft delete the posts (from 11-20)?
Should I dont delete and leave them in database and everytime user tries to change the post or visit the post say "it is not available"? And In my database calls i check everytime and user can just access the posts with the 10th smallest IDs?
Maybe there is another best practise? If you know it... I would be happy, if you can tell me how the best practise is.
There is no best practice for such scenarios; only your business rules.
My opinion; (having no wider context about your application)
(i) don't destroy the records created by the User
(ii) allow the User to choose which Posts to keep "alive"; and archive the others.
(iii) implement Policies to authorize the User to work with Post instances depending on their state.