Issue Details (XML | Word | Printable)

Key: MDL-19695
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Eloy Lafuente (stronk7)
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-14679

Any field operation (drop, rename, change_xxx) must look for field dependencies (indexes, keys...)

Created: 02/Jul/09 09:29 PM   Updated: 31/Jul/09 02:56 AM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 2.0
Fix Version/s: 2.0

Issue Links:
Dependency
 

Database: Any
Participants: Eloy Lafuente (stronk7) and Tim Hunt
Security Level: None
Difficulty: Moderate
Resolved date: 03/Jul/09
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
As explained in http://moodle.org/mod/forum/discuss.php?d=127196 current behaviour when trying to perform field ddl actions (drop field, rename, change some property...) is really not cross-db at all, with each DB following different approaches.

So, in order to get a consistent approach for any DB we are going to:

1) Create one new ddl_dependency_exception (extends ddl_change_structure_exception)
2) In dbmanager, perform the required dependency checks (mainly look for existing indexes for now) and throw that exception if dependency is found.
3) In XMLDB editor, when generating PHP code to be used in upgrade scripts, look for the XMLDB definition (not to DB!) and if there is any dependency, include php code to drop/create indexes.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 03/Jul/09 12:05 AM
MDL-19695 field dependencies - before committing the dependency checker, fix all places in upgrade
that will break once running with dependencies enabled
MODIFY lib/db/upgrade.php   Rev. 1.313    (+13 -1 lines)
Eloy Lafuente (stronk7) committed 3 files to 'Moodle CVS' - 03/Jul/09 12:08 AM
MDL-19695 field dependencies - defined new exception ddl_dependency_exception that
will be thrown when one DDL operation (drop only for now) is attempted over one
field being part of indexes.
MODIFY lang/en_utf8/error.php   Rev. 1.194    (+2 -1 lines)
MODIFY lib/ddllib.php   Rev. 1.76    (+17 -0 lines)
MODIFY lib/ddl/database_manager.php   Rev. 1.28    (+46 -15 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 03/Jul/09 12:13 AM
MDL-19057 ddl tests - slowly advancing. Added some test to check for MDL-19695 behaviour
MODIFY lib/ddl/simpletest/testddl.php   Rev. 1.14    (+228 -26 lines)
Mitsuhiro Yoshida committed 5 files to 'Lang CVS' - 04/Jul/09 12:28 AM
MDL-19077 Translated new strings for theme change URL.
MDL-19692 Translated a new string for completion tickboxes.
MDL-19692: Updated a translated string for completion tickboxes.
MDL-19695 Translated a new string for field dependencies.
MDL-19696 Translated a new string for install.
MODIFY ja_utf8/error.php   Rev. 1.140    (+23 -22 lines)
MODIFY ja_utf8/completion.php   Rev. 1.8    (+3 -2 lines)
MODIFY ja_utf8/admin.php   Rev. 1.358    (+3 -1 lines)
MODIFY ja_utf8/README   Rev. 1.1025    (+1 -1 lines)
MODIFY ja_utf8/moodle.php   Rev. 1.360    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 05/Jul/09 12:43 AM
MDL-19695 New string added
MODIFY fr_utf8/error.php   Rev. 1.197    (+1 -0 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 31/Jul/09 02:48 AM
MDL-19701, MDL-19695 ddl stuff - review upgrade to enforce dependencies on every field operation
MODIFY lib/db/upgrade.php   Rev. 1.321    (+17 -1 lines)
Eloy Lafuente (stronk7) committed 1 file to 'Moodle CVS' - 31/Jul/09 02:54 AM
MDL-19695 dependencies - now every change_field_xxx() method looks for dependencies
MODIFY lib/ddl/database_manager.php   Rev. 1.29    (+4 -0 lines)