Issue Details (XML | Word | Printable)

Key: MDL-15635
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Penny Leach
Reporter: Penny Leach
Votes: 0
Watchers: 5
Operations

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

[gsoc] database migration utility

Created: 13/Jul/08 09:04 PM   Updated: 17/Jul/08 06:41 AM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 2.0
Fix Version/s: 2.0

Issue Links:
Relates
 

Database: Any
Participants: Andrei Bautu, Dan Poltawski, Eloy Lafuente (stronk7), Penny Leach and Petr Skoda
Security Level: None
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE

Sub-Tasks  All   Open   
 Sub-Task Progress: 

 Description  « Hide
Utility to completely export and import a moodle database in a db-neutral format/

After a long discussion, Petr and I agreed on the following:

1. Data should not use STATEMENT but instead we will add a new part to the XMLDB file, CONTENT or something similar which contains all the data (Eloy to help here to decide the exact format)

2. Current pieces of data in the XMLDB file should move from STATEMENT to CONTENT so that they are handled by dml rather than ddl.

3. The export file should contain both schema and data, but the schema should come from the code install.xml, and should not be used when importing, but used to compare with the target system code.xml (so as to not try to import data into a schema that does not fit it)

4. Introduction of new $DB->import_record function (used to import CONTENT parts of install.xml)

5. Introduction of new contract reset_sequence function (for given table or all tables) to be implemented per driver (postgres will set sequence value, mysql will probably do nothing, not sure about ora or mssql yet)

6. Different ways to export and import moodle database:

- During moodle installation, add hook to install from a file or a remote database (before first steps that insert data, ideally)
- Admin UI - blow away current database (truncate tables) and import data from file or connection to remote database
- Admin UI - export current database to file, or into remote database

General notes:

Schema should never be imported, only used for comparison.
Export file should contain moodle version (it is in data content already but it should also be in xmldb if not already) and this should be checked at import time.


Andrei - I would like you to create subtasks for each individual component here you can see and write a specification in the wiki before you write any more code here. I am aware this is different to what you've already implemented (although I hope you'll be able to reuse much of the code) and I want to avoid this happening in the future ( this is definitely at least my fault in part for not getting back to you sooner )

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Petr Skoda committed 3 files to 'Moodle CVS' - 31/Aug/08 02:46 AM
MDL-15635 sqlite fixes - by Andrei Bautu
MODIFY lib/dml/pdo_moodle_database.php   Rev. 1.10    (+10 -4 lines)
MODIFY lib/ddl/sqlite_sql_generator.php   Rev. 1.3    (+175 -35 lines)
MODIFY lib/dml/sqlite3_pdo_moodle_database.php   Rev. 1.5    (+41 -27 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 31/Aug/08 02:47 AM
MDL-15635 library inclusion refactoring
MODIFY lib/ddllib.php   Rev. 1.69    (+15 -3 lines)
MODIFY lib/adminlib.php   Rev. 1.252    (+4 -16 lines)
Petr Skoda committed 2 files to 'Moodle CVS' - 31/Aug/08 02:48 AM
MDL-15635 dml library inclusion refactoring
MODIFY lib/ddl/database_manager.php   Rev. 1.14    (+2 -1 lines)
MODIFY lib/dml/moodle_database.php   Rev. 1.46    (+2 -3 lines)
Petr Skoda committed 17 files to 'Moodle CVS' - 03/Sep/08 05:20 AM
MDL-15635 dtl refactoring and basic export and transfer ui (the import UI will be part of install process soon) - based largely on code by Andrei Bautu - thanks!
MODIFY lib/dtl/database_mover.php   Rev. 1.2    (+4 -4 lines)
MODIFY lib/dtllib.php   Rev. 1.2    (+9 -16 lines)
MODIFY lib/dtl/string_xml_database_importer.php   Rev. 1.2    (+2 -3 lines)
MODIFY lib/dtl/xml_database_importer.php   Rev. 1.2    (+8 -10 lines)
MODIFY lang/en_utf8/admin.php   Rev. 1.224    (+1 -0 lines)
ADD admin/dbtransfer/database_transfer_form.php   Rev. 1.1    (+0 -0 lines)
ADD admin/dbtransfer/index.php   Rev. 1.1    (+0 -0 lines)
MODIFY lib/dtl/file_xml_database_exporter.php   Rev. 1.2    (+3 -6 lines)
MODIFY lib/dtl/database_importer.php   Rev. 1.2    (+18 -13 lines)
MODIFY lib/dtl/string_xml_database_exporter.php   Rev. 1.2    (+2 -2 lines)
MODIFY lib/dtl/file_xml_database_importer.php   Rev. 1.2    (+3 -7 lines)
MODIFY admin/settings/Attic/misc.php   Rev. 1.24    (+10 -4 lines)
MODIFY lib/dtl/database_exporter.php   Rev. 1.2    (+14 -8 lines)
ADD lang/en_utf8/dbtransfer.php   Rev. 1.1    (+0 -0 lines)
ADD admin/dbtransfer/lib.php   Rev. 1.3    (+0 -0 lines)
ADD admin/dbtransfer/dbexport.php   Rev. 1.1    (+0 -0 lines)
ADD admin/dbtransfer/database_export_form.php   Rev. 1.1    (+0 -0 lines)
Mitsuhiro Yoshida committed 2 files to 'Lang CVS' - 03/Sep/08 12:02 PM
MDL-15635 - Translated a new strings for admin.
MDL-15635 - Adding a translated lang file for Database transfer.
MODIFY ja_utf8/admin.php   Rev. 1.298    (+2 -1 lines)
ADD ja_utf8/dbtransfer.php   Rev. 1.1    (+0 -0 lines)
martignoni committed 2 files to 'Lang CVS' - 08/Sep/08 03:24 AM
MDL-15635 new strings for database transfer
MODIFY fr_utf8/admin.php   Rev. 1.297    (+2 -1 lines)
ADD fr_utf8/dbtransfer.php   Rev. 1.1    (+0 -0 lines)