Moodle

Inconsistent schema when upgrading

Details

  • Database:
    PostgreSQL
  • Difficulty:
    Moderate
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

Description

When upgrading from 1.8.5+ (Build: 20080507) to 1.9.2+ (Build: 20080725), the following schema inconsistencies occur:

1.) The field grade_items_history.decimals exists, when it does not in lib/db/install.xml
2.) The field grade_items_history.display exists, when it does not in lib/db/install.xml
3.) grade_letters.contextid has a default of 0, when lib/db/install.xml has no default

Activity

Hide
Chris Bandy added a comment -

Exactly the same in 1.9.3+ (Build: 20081020)

Show
Chris Bandy added a comment - Exactly the same in 1.9.3+ (Build: 20081020)
Hide
Matthew Davidson added a comment -

To be clear, for anyone else that might see this unresolved bug. Is it safe to remove the decimals and display fields since they no longer exist in a fresh install?

Show
Matthew Davidson added a comment - To be clear, for anyone else that might see this unresolved bug. Is it safe to remove the decimals and display fields since they no longer exist in a fresh install?
Hide
Eloy Lafuente (stronk7) added a comment - - edited

Moving this to the stable backlog and assigning to Sam, that recently was working in other DB discrepancies.

TODO:

Both in 19_STABLE and 20_STABLE upgrade.php

1) if exists drop the grade_items_history.decimals (verify it hadn't associated indexes/keys originally)
2) if exists drop the grade_items_history.display (verify it hadn't associated indexes/keys originally)
3) if grade_letters.contextid has default:

  • delete all records having contextid = 0
  • drop associated index
  • drop the default
  • recreate the index

That way, at the end, anyone updating to 1.9.10 / 2.0.2 or later, will get the schema fixed.

Matthew, yes I think it's safe to drop them in case this issue isn't caught for fixing soon. If dropped, the proposed solution above will, simply do nothing.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - - edited Moving this to the stable backlog and assigning to Sam, that recently was working in other DB discrepancies. TODO: Both in 19_STABLE and 20_STABLE upgrade.php 1) if exists drop the grade_items_history.decimals (verify it hadn't associated indexes/keys originally) 2) if exists drop the grade_items_history.display (verify it hadn't associated indexes/keys originally) 3) if grade_letters.contextid has default:
  • delete all records having contextid = 0
  • drop associated index
  • drop the default
  • recreate the index
That way, at the end, anyone updating to 1.9.10 / 2.0.2 or later, will get the schema fixed. Matthew, yes I think it's safe to drop them in case this issue isn't caught for fixing soon. If dropped, the proposed solution above will, simply do nothing. Ciao

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated: