NAME

Convos::Upgrader - Apply changes from one convos version to another

DESCRIPTION

This class can to upgrade the convos database from one version to another.

Before running the upgrade, we try to do a backup of the current redis data related to convos. If that fail, we do not continue.

The upgrade is done by fetching the current version that is stored in the database and run the steps from the version after and up to the lastest version available. Each step is described in the Convos::Upgrader namespace.

It is possible to set the environment variable "CONVOS_FORCE_UPGRADE" if you want to skip the backup step.

STEPS

ATTRIBUTES

steps

Holds a list of Convos::Upgrader::v_xxx objects that will be used to upgrade Convos. This attribute is initialized by "running_latest".

redis

Holds a Mojo::Redis object. Required in constructor to avoid migrating the wrong database.

version

Holds the current version. This attribute is initialized by "running_latest".

METHODS

run

$self->run(sub {
  my($self, $err) = @_;
});

This method will check the current database version and run upgrade steps to the wanted version. $err will be false if everything went well.

running_latest

$self = $self->running_latest(sub {
  my($self, $bool) = @_;
});

Check if the latest version of the Convos database is in effect.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org