-
Bug
-
Resolution: Fixed
-
Minor
-
2.0
-
None
-
Any
-
MOODLE_20_STABLE
-
MOODLE_23_STABLE
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 )