Michael Peters > Smolder-1.51 > Smolder::Upgrade

Download:
Smolder-1.51.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  7
Open  15
View/Report Bugs
Source   Latest Release: Smolder-1.52

NAME ^

Smolder::Upgrade - Base class for Smolder upgrade modules

SYNOPSIS ^

    use base 'Smolder::Upgrade';
    sub pre_db_upgrade  {....}
    sub post_db_upgrade { ... }

DESCRIPTION ^

This module is intended to be used as a parent class for Smolder upgrade modules.

METHODS

new

The new() method is a constructor which creates a trivial object from a hash. Your upgrade modules may use this to store state information.

upgrade

This method looks at the current db_version of the database being used and then decides which upgrade modules should be run. Upgrade modules are children of this module and have the following naming pattern: Smolder::Upgrade::VX_YZ where X.YZ is the version number.

So for example if the current version is at 1.35 and we are upgrading to 1.67, then any Smolder::Upgrade::VX_YZ modules between those 2 versions are run.

version_upgrade

This method is called by upgrade() for each upgrade version module. It shouldn't be called directly from anyway else except for testing.

It performs the following steps:

  1. Call the pre_db_upgrade method .
  2. Run the SQL upgrade file found in sql/upgrade/ that has the same version which is named for this same version. So an upgrade module named V1_23 will run the upgrade/V1_23.sql file if it exists.
  3. Call the post_db_upgrade method.

pre_db_upgrade

This method must be implemented in your subclass. It is called before the SQL upgrade file is run. It receives the Smolder::Platform class for the given platform.

post_db_upgrade

This method must be implemented in your subclass. It is called after the SQL upgrade file is run. It receives the Smolder::Platform class for the given platform.

add_to_config

This method will take a given string and add it to the end of the current configuration file. This is useful for adding new required directives with a reasonable default.

syntax highlighting: