vendor/davedevelopment/phpmig/src/Phpmig/Adapter/CodeIgniter/Db.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
/**
 * @package    Phpmig
 * @subpackage Phpmig\Adapter
 */
namespace Phpmig\Adapter\CodeIgniter;

use \Phpmig\Migration\Migration,
    \Phpmig\Adapter\AdapterInterface;

class Db implements AdapterInterface
{
    protected $ci = null;

    protected $connection = null;

    protected $tableName = null;

    public function __construct($tableName)
    {
        $this->ci = &get_instance();
        $this->ci->load->dbforge();
        $this->tableName = $tableName;
        $this->connection = $this->ci->db;
    }

    public function fetchAll()
    {
        $rows = array();

        $query = $this->connection->get($this->tableName);

        foreach ($query->result() as $row) {
           $rows[] = $row->version;
        }

        return $rows;
    }

    public function up(Migration $migration)
    {
        $this->connection->insert(
            $this->tableName,
            array(
                'version' => $migration->getVersion()
            )
        );

        return $this;
    }

    public function down(Migration $migration)
    {
        $this->connection->where('version', $migration->getVersion());
        $this->connection->delete($this->tableName);

        return $this;
    }

    public function hasSchema()

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。