/** * Constructor. * * @param \CodeIgniter\Database\Forge $forge */ public function __construct(Forge $forge = null) { $this->forge = !is_null($forge) ? $forge : \Config\Database::forge($this->DBGroup); $this->db = $this->forge->getConnection(); }
/** * Ensures that we have created our migrations table * in the database. */ protected function ensureTable() { if ($this->db->tableExists($this->table)) { return; } $forge = \Config\Database::forge(); $forge->addField(['version' => ['type' => 'BIGINT', 'constraint' => 20, 'null' => false], 'group' => ['type' => 'varchar', 'constraint' => 255, 'null' => false], 'time' => ['type' => 'timestamp', 'null' => false]]); $forge->createTable($this->table, true); }