PrayTeam / scriptured-prayer

GNU Affero General Public License v3.0
1 stars 0 forks source link

Schema Changes for Simplification #14

Closed Soyokaze-42 closed 9 months ago

Soyokaze-42 commented 9 months ago

rename Prayer PrayerDeck Add last_prayed date remove PrayerUserCard replace prayerusercard with usercard in PrayerDeck add UserCardPrayed table with usercard, date_prayed remove use_count and adjustment from usercard

Soyokaze-42 commented 9 months ago

@kenancasey I'm looking at this schema change and removing PrayerUserCard. Since we have a many-to-many relationship between the UserCard and the PrayerDeck, I have to use a table. You called this an association table. Django calls it a "through" model. Instead of creating the association table and the userCardLog table, why don't we just rename the PrayerUserCard PrayerDeckUserCard and replace used with the timestamp field for when it was prayed?

asherlloyd commented 9 months ago

Let's go that route since it gives us the bonus of the timestamp (metrics, etc.) we were talking about!

kenancasey commented 9 months ago

But we still need that UserCardPrayed table to record all the prayers to record all the stats.

Soyokaze-42 commented 9 months ago

Not if we store the date prayed in the PrayerDeckUserCard table. That would have all the same information plus the PrayerDeck. We just have to keep the PrayerDecks and the PrayerDeckUserCards.

kenancasey commented 9 months ago

Sorry. I've forgotten the structure of those tables. Can you remind me what fields each one contains?

Soyokaze-42 commented 9 months ago

Here is the new one. image

And the old one from the repo: image

Soyokaze-42 commented 9 months ago

While looking at this, I assumed we would want to keep the prayerdecks around for the same historical reasons we are keeping the log of CardsPrayed. If we will only have one PrayerDeck at any given time, we do not need the PrayerDeckUserCard table (besides the history we would be storing there).

Soyokaze-42 commented 9 months ago

I just submitted a PR for this. Yay for schema!