Remove redundant nid/vid fields in questions

Created on 28 December 2014, almost 10 years ago
Updated 26 July 2024, 3 months ago

Problem/Motivation

I was trying to do #2378359: Convert Questions to D7 Entity API β†’ when I noticed that we have redundant data storage and cannot correctly make Quiz questions entities. Any efforts would just be heading in the wrong direction.

Now that quiz "questions" {quiz_question_properties table} are considered an entity internally let's make the built in question types relate to them only on the question ID instead of nid/vid. We gain a couple things from this including Entity definitions and Views support now that they will relate on 1 field. Having redundant primary keys is also bad practice.

This also will take the versioning responsibility off of the question and question types as it will allow us to take advantage of EntityAPIControllerRevisionableInterface later.

For example

quiz_question_properties ("question" table)
- nid
- vid
- qqp_id

Proposed resolution

quiz_truefalse_node
- nid
- vid
(should be:)

quiz_truefalse_node
- qqp_id

This helps with #2378359: Convert Questions to D7 Entity API β†’ , as when using entity API/Views we prefer single non-redundant keys on tables when linking to another table.

Remaining tasks

- Migrate question types schema nid/vid to qqp_id
- Update entity reference definitions so that questions types relate back to the qqp table.
- Change "saveNodeProperties" to just "saveProperties" as we are not saving nid/vid anymore.

User interface changes

None

API changes

Schema fields (not yet accessible to Views) change.

πŸ“Œ Task
Status

Postponed: needs info

Version

5.0

Component

Code - Quiz core

Created by

πŸ‡ΊπŸ‡ΈUnited States djdevin Philadelphia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024