Ejemplo n.º 1
0
 /**
  * Run database table updates.
  *
  * @return \Bolt\Storage\Database\Schema\SchemaCheck
  */
 public function update()
 {
     // Do the initial check
     $this->getSchemaComparator()->compare();
     $response = $this->getSchemaComparator()->getResponse();
     $creates = $this->getSchemaComparator()->getCreates();
     $alters = $this->getSchemaComparator()->getAlters();
     $modifier = new TableModifier($this->connection, $this->app['logger.system'], $this->app['logger.flash']);
     $modifier->createTables($creates, $response);
     $modifier->alterTables($alters, $response);
     // Recheck now that we've processed
     $this->getSchemaComparator()->compare();
     if (!$this->getSchemaComparator()->hasPending()) {
         $this->getSchemaTimer()->setCheckExpiry();
     }
     return $response;
 }
Ejemplo n.º 2
0
 /**
  * Run database table updates.
  *
  * @return \Bolt\Storage\Database\Schema\SchemaCheck
  */
 public function update()
 {
     // Do the initial check
     $fromTables = $this->getInstalledTables();
     $toTables = $this->getSchemaTables();
     $this->getSchemaComparator()->compare($fromTables, $toTables, $this->app['schema.content_tables']->keys());
     $response = $this->getSchemaComparator()->getResponse();
     $creates = $this->getSchemaComparator()->getCreates();
     $alters = $this->getSchemaComparator()->getAlters();
     $modifier = new TableModifier($this->connection, $this->app['logger.system'], $this->app['logger.flash']);
     $modifier->createTables($creates, $response);
     $modifier->alterTables($alters, $response);
     $event = new SchemaEvent($creates, $alters);
     $this->app['dispatcher']->dispatch(SchemaEvents::UPDATE, $event);
     // Recheck now that we've processed
     $fromTables = $this->getInstalledTables();
     $toTables = $this->getSchemaTables();
     $this->getSchemaComparator()->compare($fromTables, $toTables, $this->app['schema.content_tables']->keys());
     if (!$this->getSchemaComparator()->hasPending($fromTables, $toTables, $this->app['schema.content_tables']->keys())) {
         $this->getSchemaTimer()->setCheckExpiry();
     }
     return $response;
 }