wiki:SchemaEvolution

Version 1 (modified by tousigna, 14 years ago) (diff)

explain some bits and bolts about the schema evolution

What is it about

It's to permit developer to be able to change the schema of the reporting database easily so the user does not need to worry about database changes and upgrades. It's also simplify the installation of the reporting system as it's create the tables for you. You'll still need to create the database before.

The way it work

To keep track of the revision of the database, it's create a new table with revision and the date of the upgrade. Then it's if the database is to be upgraded, it take the last revision in the database and compare them with the one in the updatefix.py, if there is more revision, it will execute the new query.

What to do to add a new revision

To add a new modification to the database, you'll need to change the updatefix.py for the old database to be upgraded. Find the array _fixes and append a new query of function to it and it will be executed on the next restart of bcfg2 or import of xml file. You'll also need to add a new entry in the internal revision table for the fresh installation of the reports system.

Modification since 0.9.5.6

  • Revision 0
    • Merge the tables reports_bad, reports_modified and reports_extra in a single tables named reports_entries and remove all duplication of entries name
    • Merge the interaction of all 3 table into a single one and typed the type of interaction as 1 for bad, 2 for modified and 3 for extra, so we could add new type of interactions.
    • Moved the reason of interaction from the entries to the actual interaction with the entries.
  • Revision 1
    • Removed the un-necessary table reports_bad
  • Revision 2
    • Removed the un-necessary table reports_bad_interactions
  • Revision 3
    • Removed the un-necessary table reports_extra
  • Revision 4
    • Removed the un-necessary table reports_extra_interactions
  • Revision 5
    • Removed the un-necessary table reports_modified
  • Revision 6
    • Removed the un-necessary table reports_modified_interactions
  • Revision 7
    • Removed the deprecated table reports_repository
  • Revision 8
    • Removed the deprecated table reports_metadata
  • Revision 9
    • Added a columns to the reports_interaction to keep track of witch server did the importation on a multiple bcfg2 server network.