I am really searching for something much like the way in which Same with setup in which a couple of different types of things could be chosen on (questions AND solutions). What type of DB schema, generally, could I personally use to aid voting on many different types of objects?

Would I've got a single Election table that will have references with other objects within the database? Or must i have or must have another election table for each one of the objects I must election on.


it's a little confusing what you require...but here's my 2 cents:

I suppose you would like for every election to keep if this was chosen, by whom (maybe Ip or user title), I'd get a single Voting table solution. I additionally think that whenever you query an entity in the DB (question, answer, etc.), you should also join this table, and it is unlikely to possess a query exclusively around the voting table.

within this situation, you should use 2 posts around the voting table Body for the kind of object which was chosen, and something to carry the id of this object. that method for you to join the voting table holiday to a query by indicating the kind of the item.

I believe controlling all of your votes in one table can make your domain simpler then distributing it and developing a voting table for every entity. within this single voting table solution you only have to keep up with the listing of kinds of organizations (most likely utilizing a small dictionary table).

there's additionally a thought on performance. should you expect countless votes, that single table will grow a lot more rapidly than some separate tables. it may be considered against it. also be certain to not turn it into a bottleneck if you will find many concurrent read/creates into it.