• fonginator

    (@fonginator)


    I’m trying to determine the ideal way to store some user data that will be associated to posts of a custom post type (charities). The data I need to store per user will be collected over time, and will include data such as:

    1. Date of contribution (month/year – only one amount per month)
    2. Contribution (some dollar amount)
    3. Date of update (the date/time this entry was last modified)

    This data is collected on an ongoing basis for each user to a single post.

    I should be able to not only query which users have contributed to a given charity, I should also be able to determine total contributions to each charity over a given time period.

    My instinct would be to set up a separate database table to track contributions whose structure might resemble this:

    user_id (int)
    post_id (int)
    contribution_date (date)
    contribution_amount (decimal)
    last_modified (date/time)

    Or, I suppose I could store this as user meta data, using variable meta data keys like this:

    1. custom_$postid_contribution_date
    2. custom_$postid_contribution_amount
    3. custom_$postid_last_modified

    Am I wrong to be considering the meta option? It seems to me that the latter risks getting a bit unmanageable over time and (perhaps?) harder to query for the data I need.

  • The topic ‘Custom meta data or custom DB table for data storage?’ is closed to new replies.