Skip to end of metadata
Go to start of metadata

Database Schema Changes

Quick notes on making database schema changes.

 


 

Icon

These notes are about making changes to the core Revive Adserver database schema. If you are planning on making changes to the core schema to support a pull request for Revive Adserver, it is strongly recommended that you discuss the changes with the core development team first; core database schema changes are unlikely to be accepted without prior agreement.

 

  • Check out Revive Adserver from GitHub
  • Install Revive Adserver from the checkout
  • Ensure that the following directories and all files within can be written to by the web server:
    • revive-adserver/etc/
    • revive-adserver/lib/max/Dal/DataObjects/
  • Use a browser to go to Revive Adserver's /www/devel directory
  • Click on Schemas > Schema Editor
  • Ensure that the "tables_core.xml" schema is being used
  • Copy the current final schema to transitional
  • Edit the schema
  • Review the changes & make final; ensure a proper comment for the reason for the schema change is used
  • Check all generated files are present and correct:
    • revive-adserver/etc/tables_core.xml changed as expected
    • New revive-adserver/etc/changes/changes_tables_core_XXX.xml created and contains constructive/destructive changes as expected
    • New revive-adserver/etc/changes/schema_tables_core_XXX.xml created and identical to revive-adserver/etc/tables_core.xml
    • New revive-adserver/etc/changes/migration_tables_core_XXX.php created
    • New revive_adserver/etc/changes/schema_tables_core_XXX.xml differs from previous version as expected, and matching changes seen in revive-adserver/etc/tables_core.xml
    • Appropriate table file(s) created/updated/removed in revive-adserver/lib/max/Dal/DataObjects
    • Appropriate table definition(s) created/updated/removed in revive-adserver/lib/max/Dal/DataObjects/db_schema.ini
  • Manually update the revive-adserver/etc/changes/migration_tables_core_XXX.php file if required to manage data migrations required for the schema change(s)
  • Create upgrade package:
    • Manually create an upgrade file in revive-adserver/etc/changes/openads_upgrade_X.X.X-rcX.xml with an appropriate version number for the next release
    • Edit the file to include the required details of the database schema change to be applied for the upgrade
    • Use a browser to go to Revive Adserver's /www/devel directory
    • Click on Upgrade Packages Array > OpenX Core
  • Check that the revive-adserver/etc/changes/openads_upgrade_array.txt has been updated to include the new upgrade package
  • Perform an upgrade and check the database changes are applied
  • Perform an install and check the database is created as expected
  • Run the test suit (ignore test failures for tests relating to the binary caches for the various XML files for the schema) 
  • Commit

 

Icon

The post-commit hooks should automatically re-generate all required binary caches for the various XML files for the schema.

If this doesn't happen, the ant task to re-generate the cache files is:

 

 

 

  • No labels