我試圖使用遷移首次對我在開發項目的Propel(所以我沒有重新插入數據的15MB),但我有一些困難。我在我的模式中進行了更改並運行propel-gen diff
。我第一次收到一個錯誤,它找不到我的buildtime-conf.xml
文件。我還沒有做過(因爲它沒有必要),但是請注意結構應該與runtime-conf.xml
相同。我將runtime-conf.xml
複製到buildtime-conf.xml
。而現在收到以下錯誤:行走PostgreSQL的移民無法找到適配器
[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.
我的運行和生成時的文件如下所示:
<?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">
,錯誤更改爲Unable to find adapter for datasource [testing]
。所以錯誤在於實際的buildtime-conf文件(不是模式),據我所知。我想也許Propel找不到PostgreSQL的適配器(儘管它在我的runtime-conf中工作正常),所以我嘗試將我的適配器更改爲mysql
。它提出了相同的無法找到適配器錯誤。
我完全失去了,想法?
更新:所以我能夠進入/Propel/runtime/lib/Propel.php
並找到Unable to find adapter
異常被拋出的行。我通過添加行self::$configuration['datasources'][$name]['adapter'] = 'pgsql'
手動定義變量,它的工作原理。這顯然目前尚未驗證有用,因爲如果不重做此更改,我將無法更新Propel。我在Propel.php中甩了self::$configuration
,它是NULL
,有什麼想法爲什麼?
你正在運行什麼版本?如果它是1.6,那仍然支持afaik - 我會提交一個bug。這似乎是遷移的東西沒有初始化連接,但我根本不知道內部。另外,如果你想壓縮一個完整的schema.xml和build.properties,我會嘗試在我的機器上進行遷移,如果你喜歡的話(還沒有嘗試過,但保持它的意義!)。 – halfer