I have a 'Text' table, the text table may came from different source, like Tweet, SMS, Email, etc. and each source have their own log, and Text is came from the source. so i came with some solution, but i don't know which is the best.
Solution 1 :
Text(
text_id PK
content
source_type (tweet, sms, email, etc)
source_id (can't be FK since it may contain sms_id, tweet_id, or email_id)
)
Tweet(
tweet_id PK
tweet_text
tweet_username
etc...
)
Sms(
sms_id PK
sms_text
sender_number
etc...
)
Email(
email_id PK
email_text
email_sender
etc...
)
Solution 2 :
Text(
text_id PK
content
sms_id FK
tweet_id FK
email_id FK
)
Tweet(
tweet_id PK
tweet_text
tweet_username
etc...
)
Sms(
sms_id PK
sms_text
sender_number
etc...
)
Email(
email_id PK
email_text
email_sender
etc...
)
Please note that one 'Text' only came from one source.
so if I use solution 2, let say the source is came from sms then the data will look like this
Text(
12
'the text'
333
null
null
)
Sms(
333
'the text'
0818833733664
etc...
)
so which is the best approach ?
UPDATE : I miss a big part on my question, and that's are may fault, sorry for that. In my case the Text also may came from a csv(excell) file. which mean one file may have many text, because the file is a dump for many text(coma or row separated). SMS, Tweet, and Email relation with Text is one to one, but File with Text is One to Many so the big missing part in my question is the File Table
File(
file_id PK
file_name
etc..
)

