/** * Create file with given SQL update. */ public function actionCreate() { $this->checkIsAjax(); $sql = $this->getParameter("sql"); $showAll = \Nette\Utils\Json::decode($this->getParameter("showAll")); $isFull = \Nette\Utils\Json::decode($this->getParameter("isFull")); if ($this->updator->createUpdate($isFull, $sql)) { $this->updatorRender->findUpdates(true); $this->payload->state = true; $this->payload->message = "File successfully created"; $this->payload->table = $this->updatorRender->renderTable($showAll); $this->payload->updatesCount = $this->updatorRender->renderUpdatesCount($showAll); } else { $this->payload->state = false; $this->payload->message = "Failed!"; } $this->sendPayload(); }
/** * Find updates in database * @return UpdateContainer */ public function findUpdatesFromDb() { if (\Yadup\UpdatorService::isUpdateTableCreated($this->db, $this->dbUpdateTable)) { foreach ($this->db->table($this->dbUpdateTable)->fetchAll() as $upd) { $update = $this->getOrCreateUpdate($upd["created_at"]); $update->inDb = true; } } return $this; }