Introductory:
There is an sms table which contains data about waiting for sending sms. There is also a text_patterns table that stores text patterns prepared by the user. In the sms table there is a field pattern_id - connection with a text pattern
The user loads the csv file into the system. In the csv file, the list to which number which text template to send. 2 columns. Number id of the template.
Now it's all processed and working.
Task:
We want to add a feature so that in the second column it was possible to write not only the existing text template, but also the text to be sent. Those. I will see what is in this field - if it is a digit, then this is a text pattern, and if the string is some kind of new processing logic.
I just can not understand how I store this data in the database.
Solution options:
If the text, then create a new text template in the
text_patternstable and continue to work according to the old scheme. The decision does not like, because Templates can be very unique and you will have a separate template for each number. The template logic disappears.Add to the
smstable a text field in which to store the value. those. add thesms_textfield and link to theis_patterntest pattern (0 | 1). The decision does not like because we will have empty fields on each line, eitherpattern_idorsms_text. Also, for further data processing, I will need to write 2 requests instead of one all the time. One for sms with templates, another for sms with custom text.
Maybe there are some more beautiful solutions?