Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
473 views
in Q2A Core by

I don't have a lot of experience in data storing but here is my note, maybe someone can clear things up...

  • qa_postmetas looks useless if extra field is not used wich can be stored in qa_posts in my opinion.
  • Extravalue doesn't work with external php code. Problem with no answer to solution>
  • Emty rows are created with post id and stays even if question is deleted.
Q2A version: 1.7.1

1 Answer

+3 votes
by
selected by
 
Best answer
The table is intended for use by plugins to store their own extra data for questions. Plugins can't change the structure of core tables like qa_posts.

In theory that could have been added to the qa_posts table, but I think Gideon did it like that to allow the potential of more fields in future.

The main advantage of doing it this way is that there does not always have to be a row in qa_postmetas for every post. For example with the "extra field for questions" it only stores a value if the post is a question. Plugins may also only store values for certain post types.

Your second bullet point is incorrect - I answered your other question.

Your last point could be a bug. If the extra field is empty, it doesn't really make sense to store a row for it. And it should be deleted if the question is deleted. (Though I haven't checked if it's deleted when the cleanup operations are run in Admin > Stats.)

Edit: just tested this and rows in qa_postmetas ARE deleted when the question is deleted. Were you perhaps just hiding the questions and not deleting them? Let me know if you find a way to reproduce this bug.
...