加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – Propel PostgreSQL迁移无法找到适配器

发布时间:2020-12-13 16:41:14 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试在我的开发Propel项目中首次使用迁移(所以我不必重新插入15MB的数据),但是有一些困难.我在我的模式中进行了更改,并运行propel-gen diff.我第一次收到一个错误,找不到我的buildtime-conf.xml文件.我还没有(因为没有必要),但是读取结构应该与runtime
我正在尝试在我的开发Propel项目中首次使用迁移(所以我不必重新插入15MB的数据),但是有一些困难.我在我的模式中进行了更改,并运行propel-gen diff.我第一次收到一个错误,找不到我的buildtime-conf.xml文件.我还没有(因为没有必要),但是读取结构应该与runtime-conf.xml相同.我将runtime-conf.xml复制到buildtime-conf.xml.现在收到以下错误:
[propel-sql-diff] Reading databases structure...
[phingcall] Unable to find adapter for datasource [project].
Execution of target "sql-diff" failed for the following reason: /var/www/project/vendor/propel/propel1/generator/build-propel.xml:317:26: Execution of the target buildfile failed. Aborting.
    [phing] /var/www/project/vendor/propel/propel1/generator/build-propel.xml:317:26: Execution of the target buildfile failed. Aborting.

我的运行时和buildtime文件如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <propel>
        <datasources default="project">
            <datasource id="project">
                <adapter>pgsql</adapter>
                <connection>
                    <dsn>pgsql:host=###.###.###.###;dbname=database</dsn>
                    <user>USER</user>
                    <password>PASS</password>
                </connection>
            </datasource>
        </datasources>
    </propel>
</config>

我的模式是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<database name="project" defaultIdMethod="native">
    <table schema="accounts" name="accounts" phpName="Account" package="accounts">
        <column />
    </table>
</database>

我尝试将buildtime-conf更改为< datasource id =“testing”>并且错误更改为无法找到数据源[测试]的适配器.所以错误在于实际的buildtime-conf文件(而不是架构),据我所知.我以为也许Propel找不到PostgreSQL的适配器(即使它在我的runtime-conf中工作正常),所以我尝试将我的适配器更改为mysql.它出现了同样的无法找到适配器错误.

我完全迷失了想法?

更新:所以我可以进入/Propel/runtime/lib/Propel.php并找到无法找到适配器异常抛出的行.我通过添加行self :: $configuration [‘datasources’] [$name] [‘adapter’] =’pgsql’手动定义变量,它可以工作.这显然是没有验证有用的现在,因为我将无法更新Propel而不重做此更改.我在propel.php中抛出self :: $配置,它是NULL,任何想法为什么?

看起来像将一个Composer依赖关系转换为dev-master来修复这个问题 – 在编写本文时,当前版本(1.7.1)和master之间有 20 commits difference.迁移补丁专用 is here.

希望在适当的时候发布一个1.7.2的版本,但是应该注意的是,该团队的开发工作可能会集中在目前的Propel2(仍然是阿尔法).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读