Note that there are some explanatory texts on larger screens.

plurals
  1. POPropel PostgreSQL Migration unable to find adapter
    text
    copied!<p>I am trying to use migrations for the first time on my in-development Propel project (so I don't have to re-insert 15MB of data), but am having some difficulties. I made the changes in my schema and ran <code>propel-gen diff</code>. I first received an error that it couldn't locate my <code>buildtime-conf.xml</code> file. I hadn't made one yet (since it wasn't necessary), but read that the structure should be the same as the <code>runtime-conf.xml</code>. I copied <code>runtime-conf.xml</code> to <code>buildtime-conf.xml</code>. And now receive the following error:</p> <pre><code>[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. </code></pre> <p>My runtime and buildtime files look like the following:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;config&gt; &lt;propel&gt; &lt;datasources default="project"&gt; &lt;datasource id="project"&gt; &lt;adapter&gt;pgsql&lt;/adapter&gt; &lt;connection&gt; &lt;dsn&gt;pgsql:host=###.###.###.###;dbname=database&lt;/dsn&gt; &lt;user&gt;USER&lt;/user&gt; &lt;password&gt;PASS&lt;/password&gt; &lt;/connection&gt; &lt;/datasource&gt; &lt;/datasources&gt; &lt;/propel&gt; &lt;/config&gt; </code></pre> <p>My schema is along the lines of this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;database name="project" defaultIdMethod="native"&gt; &lt;table schema="accounts" name="accounts" phpName="Account" package="accounts"&gt; &lt;column /&gt; &lt;/table&gt; &lt;/database&gt; </code></pre> <p>I tried changing the buildtime-conf to <code>&lt;datasource id="testing"&gt;</code> and the error changed to <code>Unable to find adapter for datasource [testing]</code>. So the error lies in the actual buildtime-conf file (not the schema), as far as I can tell. I thought maybe Propel couldn't find PostgreSQL's adapter (even though it works fine in my runtime-conf), so I tried changing my adapter to <code>mysql</code>. It came up with the same unable to find adapter error.</p> <p>I'm completely lost, thoughts?</p> <p><strong>Update:</strong> so I was able to go into <code>/Propel/runtime/lib/Propel.php</code> and locate the line where the <code>Unable to find adapter</code> exception was thrown. I manually defined the variable by adding the line <code>self::$configuration['datasources'][$name]['adapter'] = 'pgsql'</code> and it works. This obviously isn't verify useful for now, as I won't be able to update Propel without redoing this change. I dumped <code>self::$configuration</code> in Propel.php and it is <code>NULL</code>, any ideas why?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload