/** * Get a xPDOManager instance. * * @param object $xpdo A reference to a specific modDataSource instance. */ function __construct(&$xpdo) { parent::__construct($xpdo); $this->dbtypes['integer'] = array('INT', 'INTEGER', 'TINYINT', 'BOOLEAN', 'SMALLINT', 'MEDIUMINT', 'BIGINT'); $this->dbtypes['boolean'] = array('BOOLEAN', 'BOOL'); $this->dbtypes['float'] = array('DECIMAL', 'DEC', 'NUMERIC', 'FLOAT', 'DOUBLE', 'DOUBLE PRECISION', 'REAL'); $this->dbtypes['string'] = array('CHAR', 'VARCHAR', 'BINARY', 'VARBINARY', 'TINYTEXT', 'TEXT', 'MEDIUMTEXT', 'LONGTEXT', 'ENUM', 'SET', 'TIME', 'YEAR'); $this->dbtypes['timestamp'] = array('TIMESTAMP'); $this->dbtypes['datetime'] = array('DATETIME'); $this->dbtypes['date'] = array('DATE'); $this->dbtypes['binary'] = array('TINYBLOB', 'BLOB', 'MEDIUMBLOB', 'LONGBLOB'); $this->dbtypes['bit'] = array('BIT'); }
/** * @param string $modelPath * @param xPDOManager $manager */ private function recreateDatabase($modelPath, $manager) { if ($this->oldConfig->getDatabase() != null) { $this->modx->addPackage($this->oldConfig->getLowCaseName(), $modelPath, $this->oldConfig->getDatabase()->getPrefix()); foreach ($this->oldConfig->getDatabase()->getSimpleObjects() as $simpleObject) { $this->modx->loadClass($simpleObject); } foreach ($this->oldConfig->getDatabase()->getTables() as $table) { $manager->removeObjectContainer($table); } } if ($this->newConfig->getDatabase() != null) { $this->modx->addPackage($this->newConfig->getLowCaseName(), $modelPath, $this->newConfig->getDatabase()->getPrefix()); foreach ($this->newConfig->getDatabase()->getSimpleObjects() as $simpleObject) { $this->modx->loadClass($simpleObject); } foreach ($this->newConfig->getDatabase()->getTables() as $table) { $manager->createObjectContainer($table); } } }