/** * Sets the database connection. * * @param \PDO $connection Connection * @return AdapterInterface */ public function setConnection(\PDO $connection) { $this->connection = $connection; // Create the schema table if it doesn't already exist if (!$this->hasSchemaTable()) { $this->createSchemaTable(); } else { $table = new Table($this->getSchemaTableName(), array(), $this); if (!$table->hasColumn('migration_name')) { $table->addColumn('migration_name', 'string', array('limit' => 100, 'after' => 'version', 'default' => null, 'null' => true))->save(); } if (!$table->hasColumn('breakpoint')) { $table->addColumn('breakpoint', 'boolean', array('default' => 0))->save(); } } return $this; }
/** * Checks to see if a column exists. * * @param string $columnName * @param array $options * * @return bool */ public function hasColumn($columnName, $options = []) { return $this->table->hasColumn($columnName, $options); }