Issue Details (XML | Word | Printable)

Key: MDL-15669
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Petr Skoda
Reporter: Andrei Bautu
Votes: 0
Watchers: 2
Operations

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

Check db schema vs install.xml

Created: 16/Jul/08 04:59 PM   Updated: 26/Aug/08 06:03 AM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 2.0
Fix Version/s: 2.0

File Attachments: 1. Text File 200807241054-database_manager.php.patch (3 kB)


Participants: Andrei Bautu, Penny Leach and Petr Skoda
Security Level: None
Resolved date: 26/Aug/08
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
Code to check that to current db schema matches install.xml.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Andrei Bautu made changes - 24/Jul/08 03:55 PM
Field Original Value New Value
Attachment 200807241054-database_manager.php.patch [ 14640 ]
Penny Leach added a comment - 25/Jul/08 01:47 AM
Hey Andrei,

Couple things:

  • obviously I can see you have a TODO about localising strings
  • You're checking for fields that exist in the database but not the schema, but not whole tables that exist in the database but not the schema. Perhaps you need to something similar to this:

unset($dbfields[$fieldname]);
paired with:
foreach($dbfields as $fieldname=>$info) {
$errors[$tablename][] = 'Field ' . $fieldname . ' is unexpected.'
}

but for tables.

Other than that, it looks good to me.


Andrei Bautu added a comment - 25/Jul/08 04:59 AM
We have this comment "we ignore other tables from the database since this can be a shared with other applications". People can have other tables in a Moodle database. We don't mind about them, because the will not export/import them.

Penny Leach added a comment - 25/Jul/08 05:14 AM
Yep, but what about ones that start with mdl_ ?

Petr Skoda added a comment - 25/Jul/08 05:52 AM
you can safely ignore the mdl_pma_xxx tables used by phpmyadmin
there is also one table from adodb without prefix that can be safely ignored

Andrei Bautu added a comment - 25/Jul/08 06:18 AM
I would say that if they are not in the install.xml files, then we don't care about them, even if their names start with mdl_. I can change this if you want to.

Petr Skoda made changes - 26/Aug/08 05:57 AM
Assignee Eloy Lafuente (stronk7) [ stronk7 ] Petr Skoda [ skodak ]
Petr Skoda made changes - 26/Aug/08 05:57 AM
Status Open [ 1 ] In Progress [ 3 ]
Petr Skoda committed 1 file to 'Moodle CVS' - 26/Aug/08 06:02 AM
MDL-15669 Check db schema vs install.xml - code by Andrei Bautu, with minor changes only (more strict checking)
MODIFY lib/ddl/database_manager.php   Rev. 1.13    (+98 -1 lines)
Petr Skoda added a comment - 26/Aug/08 06:03 AM
in cvs with minor changes, it is a bit more strict
thanks!

Petr Skoda made changes - 26/Aug/08 06:03 AM
Status In Progress [ 3 ] Resolved [ 5 ]
Resolution Fixed [ 1 ]
Fix Version/s 2.0 [ 10122 ]