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

Incorrect field type 'binary' in the table 'ai_action_register'

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_405_STABLE
    • MDL-83153-main-option1-2
    • Hide

      Notes

      1. Test on one DB type only. Either PostgreSQL or MySQL will do. Unit tests cover the rest.

      Test with the success column needing conversion

      Before the patch (See MDL-82627 for more details)
      1. Check out the latest release when MDL-82627 has landed

        git checkout 09e56f2d1a48ba4ac3f84eab424980c6255b256e
        

      2. Run a fresh install of the site.
      3. Set up an AI provider and enable the editor AI placement
      4. As an admin, edit your profile and generate text and images using AI.
      5. Try to generate AI content with a failing result (e.g. by using a wrong provider API key or organisation ID).
      6. Open your DB manager (e.g. adminer, phppgadmin, or phpmyadmin)
      7. Check "success" column in the "ai_action_register" table
      8. You'll see that the "success" column will have the following data type:
        • Postgres: bytea
        • MySQL/MariaDB: longblob
      9. You should see that the values under the "success" column should be 1 for successful requests and 0 for failed requests
      Update
      1. With the patch applied, upgrade your Moodle instance
      2. Check "success" column in the "ai_action_register" table
      3. You'll see that the "success" column will have the following data type:
        • Postgres: smallint
        • MySQL/MariaDB: tinyint
      4. You should see that the values under the "success" column should be 1 for successful requests and 0 for failed requests
      5. Go to Site administration > Reports > Performance overview
      6. Confirm that the Database schema check's status is OK.
      Generate AI content
      1. After upgrading, log in as admin, edit your profile again and add AI-generated text/images.
      2. Confirm that you can create the AI-generated content.

      Test with the success column not needing conversion.

      Before the patch
      1. Check out the latest release before MDL-82627 has landed

        git checkout 1938c438ea1
        

      2. Run a fresh install of the site
      Update
      1. Check out the latest main branch
      2. Run the upgrade
      3. Confirm that the upgrade finishes successfully.
      4. Check "success" column in the "ai_action_register" table
      5. You'll see that the "success" column will have the following data type:
        • Postgres: smallint
        • MySQL/MariaDB: tinyint
      6. Go to Site administration > Reports > Performance overview
      7. Confirm that the Database schema check's status is OK.
      Generate AI content
      1. Set up enable the Open AI provider and the Editor AI placement
      2. Edit your profile.
      3. Confirm that you can create AI-generated text/image.
      Show
      Notes Test on one DB type only. Either PostgreSQL or MySQL will do. Unit tests cover the rest. Test with the success column needing conversion Before the patch (See MDL-82627 for more details) Check out the latest release when MDL-82627 has landed git checkout 09e56f2d1a48ba4ac3f84eab424980c6255b256e Run a fresh install of the site. Set up an AI provider and enable the editor AI placement As an admin, edit your profile and generate text and images using AI. Try to generate AI content with a failing result (e.g. by using a wrong provider API key or organisation ID). Open your DB manager (e.g. adminer, phppgadmin, or phpmyadmin) Check " success " column in the " ai_action_register " table You'll see that the " success " column will have the following data type: Postgres: bytea MySQL/MariaDB: longblob You should see that the values under the "success" column should be 1 for successful requests and 0 for failed requests Update With the patch applied, upgrade your Moodle instance Check " success " column in the " ai_action_register " table You'll see that the " success " column will have the following data type: Postgres: smallint MySQL/MariaDB: tinyint You should see that the values under the "success" column should be 1 for successful requests and 0 for failed requests Go to Site administration > Reports > Performance overview Confirm that the Database schema check 's status is OK. Generate AI content After upgrading, log in as admin, edit your profile again and add AI-generated text/images. Confirm that you can create the AI-generated content. Test with the success column not needing conversion. Before the patch Check out the latest release before MDL-82627 has landed git checkout 1938c438ea1 Run a fresh install of the site Update Check out the latest main branch Run the upgrade Confirm that the upgrade finishes successfully. Check " success " column in the " ai_action_register " table You'll see that the " success " column will have the following data type: Postgres: smallint MySQL/MariaDB: tinyint Go to Site administration > Reports > Performance overview Confirm that the Database schema check 's status is OK. Generate AI content Set up enable the Open AI provider and the Editor AI placement Edit your profile. Confirm that you can create AI-generated text/image.

      In lib/db/install.xml :

          <TABLE NAME="ai_action_register" COMMENT="Stores information about processed ai actions.">
            <FIELDS>
              <FIELD NAME="success" TYPE="binary" NOTNULL="true" SEQUENCE="false" COMMENT="Was the action successful when run"/>
      

      added in MDL-82627

      Did you mean that this is a int(1) field?
      Moodle creates the 'binary' field type as 'text' in postgres or 'longblob' in mysql thinking that you want to store some large amount of binary data.

        1. (1) 9 Passed -- (Main)MDL-83153.png
          163 kB
          Kim Jared Lucas
        2. (2) 6 Passed -- (Main)MDL-83153.png
          127 kB
          Kim Jared Lucas
        3. (3) 2 Passed -- (Main)MDL-83153.png
          1.22 MB
          Kim Jared Lucas
        4. (4) 7 Passed -- (Main)MDL-83153.png
          128 kB
          Kim Jared Lucas
        5. (5) 3 Passed -- (Main)MDL-83153.png
          315 kB
          Kim Jared Lucas
        6. table_structure.png
          41 kB
          Marina Glancy

            jpataleta Jun Pataleta
            marina Marina Glancy
            Marina Glancy Marina Glancy
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 12 minutes
                5h 12m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.