Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-64587

XMLDB option to add mandatory persistent fields

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Setup
      1. Log in as admin.
      2. Go to Site administration / Development / XMLDB editor
      3. Load and edit any one of the plugin database tables (e.g. admin/tool/cohortroles/db)
      4. Click on "New table".
      Cancel adding of mandatory persistent fields.
      1. On the Edit table page, click on "Add mandatory persistent fields"
      2. Confirm that you get a confirmation message that asks if you want to add the "usermodified", "timecreated" and "timemodified" fields.
      3. Click Cancel
      4. Confirm that you are redirected to the Edit table page.
      Creating the mandatory persistent fields.
      1. Click again on "Add mandatory persistent fields", this time on the confirmation prompt, click "Back".
      2. Confirm that you get a message that the processing is complete.
      3. Click Back.
      4. Back on the Edit table page, confirm that the "usermodified", "timecreated" and "timemodified" fields have been added.
      5. Check that the field details are correct as specified in https://docs.moodle.org/dev/Persistent#Mandatory_properties
      6. Confirm that the usermodified field has a foreign key that references the id field of the user table.
      Partial creation of the mandatory persistent fields.
      1. Delete the timecreated field.
      2. Click again on "Add mandatory persistent fields".
      3. Confirm that you see a notification that usermodified and timemodified already exist.
      4. Confirm that the confirmation prompts you that the timemodified field will be added.
      5. Click Back.
      6. Confirm that the process completes.
      7. Click Back.
      8. Confirm that the timecreated field has been created.
      Trying to create mandatory persistent fields that have all been added
      1. Click again on "Add mandatory persistent fields".
      2. Confirm that you get a notification that the "usermodified", "timecreated" and "timemodified" fields already exist.
      3. Confirm you only see a Back and there's no confirmation prompt to add any of the fields.
      4. Click Back.
      5. Confirm that you are back to the Edit table page.
      Show
      Setup Log in as admin. Go to Site administration / Development / XMLDB editor Load and edit any one of the plugin database tables (e.g. admin/tool/cohortroles/db) Click on " New table ". Cancel adding of mandatory persistent fields. On the Edit table page, click on " Add mandatory persistent fields " Confirm that you get a confirmation message that asks if you want to add the " usermodified ", " timecreated " and " timemodified " fields. Click Cancel Confirm that you are redirected to the Edit table page. Creating the mandatory persistent fields. Click again on " Add mandatory persistent fields ", this time on the confirmation prompt, click " Back ". Confirm that you get a message that the processing is complete. Click Back. Back on the Edit table page, confirm that the " usermodified ", " timecreated " and " timemodified " fields have been added. Check that the field details are correct as specified in https://docs.moodle.org/dev/Persistent#Mandatory_properties Confirm that the usermodified field has a foreign key that references the id field of the user table. Partial creation of the mandatory persistent fields. Delete the timecreated field. Click again on " Add mandatory persistent fields ". Confirm that you see a notification that usermodified and timemodified already exist. Confirm that the confirmation prompts you that the timemodified field will be added. Click Back. Confirm that the process completes. Click Back. Confirm that the timecreated field has been created. Trying to create mandatory persistent fields that have all been added Click again on " Add mandatory persistent fields ". Confirm that you get a notification that the " usermodified ", " timecreated " and " timemodified " fields already exist. Confirm you only see a Back and there's no confirmation prompt to add any of the fields. Click Back. Confirm that you are back to the Edit table page.
    • Affected Branches:
      MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull Master Branch:
      MDL-64587-master

      Description

      When using the persistent API, it would be useful to have an option in the XMLDB editor to add the three mandatory properties that are "always added to your persistent and should be reflected in your database table". (https://docs.moodle.org/dev/Persistent#Mandatory_properties)

      This would save a fair amount of clicking and typing, and would reduce the possibility for error (for example forgetting to add usermodified as a foreign key).

        Attachments

        1. success-list-added-fields.png
          success-list-added-fields.png
          22 kB
        2. back-all-exists.png
          back-all-exists.png
          29 kB
        3. back-sucess.png
          back-sucess.png
          18 kB
        4. MDL-64587 (2).jpg
          MDL-64587 (2).jpg
          19 kB
        5. MDL-64587.jpg
          MDL-64587.jpg
          49 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h