I have table email_sent
with fields:
- id
- user_id
- template_name
- sent_at
- opened clicks
And now I need to save data which was send for each email. I have several campaigns with differnt data. For example, campaign wich recommend call to english teacher, if user call to teacher until expire date service will return 10% of charge. So for each email I need to save teacher_id and expire date. I have serveral ways.
First to create table call_discount
with fields: email_sent_id, teacher_id, expire.
Second to create table email_sent_data
with fields: id, fieldname, value and table email_sent_to_data
with fields: email_sent_data_id, email_sent_data. But I will have huge amount of data and it will be hard to make right indexies.
Third to create table email_sent_data
with fields: id, teacher_id, expire. Add column email_sent_data_id
to table email_sent
. And if I have new campaing I will add new fields to email_sent_data
.
I have postgresql 9.1. So I can't work with JSON.