/** * Constructor. * * @param Horde_Db_Adapter $connection A DB connection object. * @param Horde_Log_Logger $logger A logger object. * @param array $options Additional options for the migrator: * - migrationsPath: directory with the * migration files. * - schemaTableName: table for storing * the schema version. * * @throws Horde_Db_Migration_Exception */ public function __construct(Horde_Db_Adapter $connection, Horde_Log_Logger $logger = null, array $options = array()) { if (!$connection->supportsMigrations()) { throw new Horde_Db_Migration_Exception('This database does not yet support migrations'); } $this->_connection = $connection; $this->_logger = $logger ? $logger : new Horde_Support_Stub(); $this->_inflector = new Horde_Support_Inflector(); if (isset($options['migrationsPath'])) { $this->_migrationsPath = $options['migrationsPath']; } if (isset($options['schemaTableName'])) { $this->_schemaTableName = $options['schemaTableName']; } $this->_initializeSchemaInformation(); }
/** * Does this adapter support migrations? * * @return boolean */ public function supportsMigrations() { return $this->_write->supportsMigrations(); }