/** * get difference between current db state and last db state, after this * create migration with auto-generated queries * * @param null $module * @param string $blacklist * @param string $whitelist * @param bool $showDiff * @param string $label * @param string $description * @return array|bool|string */ public function generateMigration($module = null, $blacklist = '', $whitelist = '', $showDiff = false, $label = '', $description = '') { $blkListedTables = array(); $blkListedTables[] = $this->_options['migrationsSchemaTable']; $blkListedTables = array_merge($blkListedTables, $this->_strToArray($blacklist)); $whtListedTables = array(); $whtListedTables = array_merge($whtListedTables, $this->_strToArray($whitelist)); $options = array(); $options['blacklist'] = $blkListedTables; if (sizeof($whtListedTables) > 0) { $options['whitelist'] = $whtListedTables; } $currDb = new Core_Db_Database($options); $lastPublishedDb = new Core_Db_Database($options, false); $lastPublishedDb->fromString($this->getLastDbState()); $diff = new Core_Db_Database_Diff($currDb, $lastPublishedDb); $difference = $diff->getDifference(); if (!count($difference['up']) && !count($difference['down'])) { return false; } else { if ($showDiff) { return $difference; } else { return $this->create($module, $difference, $label, $description); } } }