Beispiel #1
0
 /**
  * Construct migration schema.
  * @param MigratableDatabase The database to migrate.
  */
 public function __construct(MigratableDatabase $db)
 {
     $this->db = $db;
     $this->targetSchema = $db->getSchema();
     $db->refreshSchema();
     $current = $db->getSchema();
     foreach ($current->getTables() as $table) {
         $this->tables[] = $table;
         $this->schemas[$table] = $current->getSchema($table);
     }
     $db->setSchema($this);
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function run()
 {
     $this->progress($this->count / ($this->count + count($this->tables)) * 100);
     $table = $this->tables[0];
     if (!isset($this->db->{$table})) {
         $this->status(tr('Creating table "%1"...', $table));
         $this->db->createTable($this->schema->getSchema($table));
     }
     array_shift($this->tables);
     $this->count++;
 }