This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

new plugin sfPropelSqlDiffPlugin - build diff sql

Ask help about existing plugins, or find advice about the way to build up your own.

Re: Small fix for code

by yspro » Mon Mar 24, 2008 2:10 pm

You're right...

So look at:

<span name="php"><code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span style="color: #007700">if(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">]) {            foreach(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">] as </span><span style="color: #0000BB">$field</span><span style="color: #007700">=></span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">) {             </span><span style="color: #0000BB">$mycode </span><span style="color: #007700">= </span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];             </span><span style="color: #0000BB">$otherdata </span><span style="color: #007700">= @</span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">tables</span><span style="color: #007700">[</span><span style="color: #0000BB">$tablename</span><span style="color: #007700">][</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">][</span><span style="color: #0000BB">$field</span><span style="color: #007700">];             </span><span style="color: #0000BB">$othercode </span><span style="color: #007700">= @</span><span style="color: #0000BB">$otherdata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];                      if(</span><span style="color: #0000BB">$mycode </span><span style="color: #007700">and !</span><span style="color: #0000BB">$othercode</span><span style="color: #007700">) {                   if(</span><span style="color: #0000BB">$otherdata</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]==</span><span style="color: #DD0000">'PRIMARY'</span><span style="color: #007700">) { </span><span style="color: #FF8000">// <-----                     </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode; "</span><span style="color: #007700">;                   } else {                     </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX   `$field` $mycode; "</span><span style="color: #007700">;                   }             }           }        } </span><span style="color: #0000BB">?></span>
</span>
</code></span>

Maybe it should be:

<span name="php"><code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span style="color: #007700">if(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">]) {            foreach(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">] as </span><span style="color: #0000BB">$field</span><span style="color: #007700">=></span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">) {             </span><span style="color: #0000BB">$mycode </span><span style="color: #007700">= </span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];             </span><span style="color: #0000BB">$otherdata </span><span style="color: #007700">= @</span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">tables</span><span style="color: #007700">[</span><span style="color: #0000BB">$tablename</span><span style="color: #007700">][</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">][</span><span style="color: #0000BB">$field</span><span style="color: #007700">];             </span><span style="color: #0000BB">$othercode </span><span style="color: #007700">= @</span><span style="color: #0000BB">$otherdata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];                      if(</span><span style="color: #0000BB">$mycode </span><span style="color: #007700">and !</span><span style="color: #0000BB">$othercode</span><span style="color: #007700">) {                   if(</span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]==</span><span style="color: #DD0000">'PRIMARY'</span><span style="color: #007700">) {</span><span style="color: #FF8000">//if($otherdata['type']=='PRIMARY')                     </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode; "</span><span style="color: #007700">;                   } else {                     </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX   `$field` $mycode; "</span><span style="color: #007700">;                   }             }           }        } </span><span style="color: #0000BB">?></span>
</span>
</code></span>
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: Small fix for code

by gray » Mon Mar 24, 2008 3:23 pm

yspro wrote:
Maybe it should be:

You're right.
I am going to release today new version with all patches and corrections.
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Mon Mar 24, 2008 3:39 pm

I hope this release would be stable )
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Mon Mar 24, 2008 4:48 pm

yspro wrote: I hope this release would be stable )

Currently it has version 0.1.1. I think stable release will be at 1.0.0 :D~ :-D~ :grin:
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Mon Mar 24, 2008 11:03 pm

New version has been uploaded.

Changelog:

- added task propel-update-all (thanks to naholyr)
- fixed problem with short open tags
- fixed problem with "foreign key constraint fails" error during diff.sql execution (reported by Emiliano.Gabrielli)
- primary key creation fix (by yspro)
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Mon Mar 24, 2008 11:37 pm

If you have isses with upgrading plugin please try command
Code: Select all
symfony plugin-upgrade http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1.2

instead of
Code: Select all
symfony plugin-upgrade http://plugins.symfony-project.com/sfPropelSqlDiffPlugin

I have posted ticket about it http://trac.symfony-project.com/ticket/3195
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Tue Mar 25, 2008 12:01 pm

I still have trouble with upgrading via cli:

Code: Select all

>> plugin    upgrading plugin "http://plugin...om/sfPropelSqlDiffPlugin-0.1.2"
>> pear      Could not download from
>> pear      "http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1.2"
>> pear      Invalid or missing remote package file
>> pear      Package
>> pear      "http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1.2"
>> pear      is not valid


  [Exception]
  upgrade failed
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Tue Mar 25, 2008 1:10 pm

<span name="php"><code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span style="color: #007700">if(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">]) foreach(</span><span style="color: #0000BB">$tabledata</span><span style="color: #007700">[</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">] as </span><span style="color: #0000BB">$field</span><span style="color: #007700">=></span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">) {         </span><span style="color: #0000BB">$mycode </span><span style="color: #007700">= </span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];         </span><span style="color: #0000BB">$otherdata </span><span style="color: #007700">= @</span><span style="color: #0000BB">$this</span><span style="color: #007700">-></span><span style="color: #0000BB">tables</span><span style="color: #007700">[</span><span style="color: #0000BB">$tablename</span><span style="color: #007700">][</span><span style="color: #DD0000">'keys'</span><span style="color: #007700">][</span><span style="color: #0000BB">$field</span><span style="color: #007700">];         </span><span style="color: #0000BB">$othercode </span><span style="color: #007700">= @</span><span style="color: #0000BB">$otherdata</span><span style="color: #007700">[</span><span style="color: #DD0000">'code'</span><span style="color: #007700">];         if(</span><span style="color: #0000BB">$mycode </span><span style="color: #007700">and !</span><span style="color: #0000BB">$othercode</span><span style="color: #007700">) {           if(</span><span style="color: #0000BB">$fielddata</span><span style="color: #007700">[</span><span style="color: #DD0000">'type'</span><span style="color: #007700">]==</span><span style="color: #DD0000">'PRIMARY'</span><span style="color: #007700">) {</span><span style="color: #FF8000">// was -->>> if($otherdata['type']=='PRIMARY') {             </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode; "</span><span style="color: #007700">;           } else {             </span><span style="color: #0000BB">$diff_sql </span><span style="color: #007700">.= </span><span style="color: #DD0000">"ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX  `$field` $mycode; "</span><span style="color: #007700">;           }         };       }; </span><span style="color: #0000BB">?></span>
</span>
</code></span>
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Tue Mar 25, 2008 2:37 pm

plugin doesn't correctly read all primary keys from db, there are in schema file built by native symfony command: propel-build-schema, but there aren't in $i object of run_propel_build_sql_diff() function...

How I got it:
<span name="php"><code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span style="color: #FF8000">//...... </span><span style="color: #0000BB">$i </span><span style="color: #007700">= new </span><span style="color: #0000BB">dbInfo</span><span style="color: #007700">();   </span><span style="color: #0000BB">$i</span><span style="color: #007700">-></span><span style="color: #0000BB">loadFromDb</span><span style="color: #007700">();     </span><span style="color: #0000BB">ob_start</span><span style="color: #007700">();     </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$i</span><span style="color: #007700">);     </span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'d:\db.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">ob_get_contents</span><span style="color: #007700">());     </span><span style="color: #0000BB">ob_clean</span><span style="color: #007700">();   </span><span style="color: #0000BB">$i2 </span><span style="color: #007700">= new </span><span style="color: #0000BB">dbInfo</span><span style="color: #007700">();   </span><span style="color: #0000BB">$i2</span><span style="color: #007700">-></span><span style="color: #0000BB">loadAllFilesInDir</span><span style="color: #007700">(</span><span style="color: #0000BB">sfConfig</span><span style="color: #007700">::</span><span style="color: #0000BB">get</span><span style="color: #007700">(</span><span style="color: #DD0000">'sf_data_dir'</span><span style="color: #007700">).</span><span style="color: #DD0000">'/sql'</span><span style="color: #007700">);       </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$i2</span><span style="color: #007700">);     </span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'d:\schema.txt'</span><span style="color: #007700">, </span><span style="color: #0000BB">ob_get_contents</span><span style="color: #007700">());     </span><span style="color: #0000BB">ob_end_clean</span><span style="color: #007700">(); </span><span style="color: #FF8000">//....... </span><span style="color: #0000BB">?></span>
</span>
</code></span>
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Tue Mar 25, 2008 6:26 pm

yspro wrote: plugin doesn't correctly read all primary keys from db, there are in schema file built by native symfony command: propel-build-schema, but there aren't in $i object of run_propel_build_sql_diff() function...


You mean that plugin reads data from schema.yml correctly, but incorrectly from mysql database?
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Tue Mar 25, 2008 8:26 pm

Yes... I put here some fixed pieces of code tomorrow :)~ :-)~ :smile:
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Wed Mar 26, 2008 10:28 am

At the beginning of getTableInfoFromCreate() function I inserted preg_replace call to avoid ')' in case of comments' existing:
$create_table = preg_replace('/comment\s*?=?\s*?([\'"]).*?\1/si', '', $create_table);

f.e.:
Code: Select all
CREATE TABLE `contact_email` (
  `id` int(11) unsigned NOT NULL,
  `email` varchar(255) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='used for user feedback (ex. Contact Us)'


Also small fix:

<span name="php"><code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span style="color: #FF8000">//before: </span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">"/^\s*create table `?([^\s`]+)`?\s+\((.*)\)[^\)]*$/mis"</span><span style="color: #007700">, </span><span style="color: #0000BB">$create_table</span><span style="color: #007700">, </span><span style="color: #0000BB">$matches</span><span style="color: #007700">); </span><span style="color: #FF8000">// mis flags combination is non-sense  ;) //fixed: </span><span style="color: #0000BB">preg_match</span><span style="color: #007700">(</span><span style="color: #DD0000">"/^\s*create table\s+`?([^\s`]+)`?\s+\((.*)\)[^\)]*$/is"</span><span style="color: #007700">, </span><span style="color: #0000BB">$create_table</span><span style="color: #007700">, </span><span style="color: #0000BB">$matches</span><span style="color: #007700">); </span><span style="color: #0000BB">?></span>
</span>
</code></span>

P.S.: to be continued... ;)~ ;-)~ :wink:
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by Jackovson » Tue Apr 01, 2008 7:08 pm

Hi,

does your plugin can manage shema.xml ?


I think not :lol:

So a workarround is to transform my xml into yml witht symfony task :D~ :-D~ :grin:

Bye
Jackovson
Member
 
Posts: 83
Joined: Fri Mar 23, 2007 9:11 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Wed Apr 02, 2008 11:30 am

Jackovson wrote:
does your plugin can manage shema.xml ?

Yes it can :P
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by Jackovson » Wed Apr 02, 2008 11:46 am

:shock: :shock: :shock: :shock: :shock:

Thats VERY cool :D~ :-D~ :grin:

I thinkl i will love your project 8-)


And another question :
your plugin is symfony1-1 (beta) compliant ? :lol:
Jackovson
Member
 
Posts: 83
Joined: Fri Mar 23, 2007 9:11 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Fri Apr 04, 2008 4:44 pm

My advice is to visit this thread
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by yspro » Tue Apr 08, 2008 3:41 pm

New Command Line Utility

Completely rewritten from scratch (bye, pake!)
yspro
Junior Member
 
Posts: 19
Joined: Mon Mar 24, 2008 12:31 pm
Location: Belarus::Minsk

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by pritam.gudekar » Wed Apr 09, 2008 1:52 pm

Hi,

I have some problems while using "symfony propel-build-sql-diff frontend"

I followed some steps as:
1. B'se of no pear installation on my machine I have downloaded 'sfPropelSqlDiffPlugin-0.1.2.tgz' from 'http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1 .2' and had extract the .tgz file to plugins folder. (is it ok or is it the wrong process?)
2) After this I added one filed to my db structure in schema.yml file. and as per the instructions given in http://trac.symfony-project.com/wiki/sfPropelSqlDiffPlugin, I have followed the commands.
3) But on executing 'symfony propel-build-sql-diff frontend' command it has given the following problem

Error ->

Code: Select all

propel > sql-template:
[PHP Error] Phing::include_once(propel\engine\platform\MysitePlatform.php): fail
ed to open stream: No such file or directory [line 863 of C:\wamp\www\mySite\lib
\symfony\vendor\phing\Phing.php]
[PHP Error] Phing::include_once(): Failed opening 'propel\engine\platform\Mysite
Platform.php' for inclusion (include_path='C:\wamp\www\mySite\lib\symfony\vendor
\propel-generator\classes;C:\wamp\www\mySite\config/../lib/symfony;C:\wamp\www\m
ySite;C:\wamp\www\mySite\config/../lib/symfony/vendor/propel-generator/classes;C
:\wamp\www\mySite\lib;C:\wamp\www\mySite\apps\\lib;;C:\wamp\www\mySite\config/..
/lib/symfony\vendor;.;C:\php5\pear') [line 863 of C:\wamp\www\mySite\lib\symfony
\vendor\phing\Phing.php]
Execution of target "sql-template" failed for the following reason: C:\wamp\www\
mySite\lib\symfony\vendor\propel-generator\build-propel.xml:187:1: Error importi
ng propel\engine\platform\MysitePlatform.php
[phingcall] C:\wamp\www\mySite\lib\symfony\vendor\propel-generator\build-propel.
xml:187:1: Error importing propel\engine\platform\MysitePlatform.php



After this, I am not able to go ahead....

While doing this diff.sql file is generated. But didn't get any changes into this file.

So please revert me the solution for this problem.

Thanking you,
Pritam
thanx...
...pritam
pritam.gudekar
Junior Member
 
Posts: 10
Joined: Wed Mar 19, 2008 6:45 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Wed Apr 09, 2008 2:28 pm

1. B'se of no pear installation on my machine I have downloaded 'sfPropelSqlDiffPlugin-0.1.2.tgz' from ' http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1 .2' and had extract the .tgz file to plugins folder. (is it ok or is it the wrong process?)

It is ok.

When you run
symfony propel-build-sql-diff frontend
it, at first, runs command
symfony propel-build-sql
and this command fails in your case. Try running symfony propel-build-sql separately. If it will produce errors, it isn't related with plugin, but probably with your recent changes in schema.yml
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by pritam.gudekar » Wed Apr 09, 2008 4:03 pm

Hi gray,

Yes....U r right!

The same problem is giving for 'symfony propel-build-sql' command also.

From this error I am thinking this problem is giving b'se of I am using sf_sandbox and not pear while creating the project/application. According to the error... the compiler/builder does not getting the Phing::include_once(propel\engine\platform\MysitePlatform.php) file. Means there is no such directories and file propel\engine\platform\MysitePlatform.php in propel folder (may be b'se of sf_sandbox not providing such file for mysql).

The default setting for the database in sf_sandbox is given 'sqlite'. So sf_sandbox may be compatibile for sqlite db and not given all settings for mysql. So that I am getting the problem while running the command for mysql and not giving the problem (runs successfully) for sqlite (this is just I am thinking).


Now I don't know exactly what is the actual problem. Do you have any Idea?

I am trying to install Pear also but again I stuck in installation.... b'se my config'n is win-xp, wamp .....so I am facing another problem..... :oops:
thanx...
...pritam
pritam.gudekar
Junior Member
 
Posts: 10
Joined: Wed Mar 19, 2008 6:45 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by pritam.gudekar » Thu Apr 10, 2008 11:20 am

Hi gray,

I found the solution..... actually it was a mistake in propel.ini file while setting the value of the propel.database parameter. By mistake I had set it to the database name instead of database type i.e. mysql.

Also I have achieved what i want i.e. changes in the database table structure without flushing data.

Thanx a million.... :D~ :-D~ :grin:
thanx...
...pritam
pritam.gudekar
Junior Member
 
Posts: 10
Joined: Wed Mar 19, 2008 6:45 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by ultimus » Thu Apr 10, 2008 6:07 pm

Please can you explain me how I can install plug-in manual.
I have not PEAR.
Is it possible?
ultimus
Junior Member
 
Posts: 4
Joined: Thu Apr 10, 2008 4:29 pm
Location: Russia

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Thu Apr 10, 2008 6:49 pm

yes, just download .tgz from wiki and run
symfony plugin-install pluginName.tgz
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by develop7 » Mon Apr 21, 2008 12:48 pm

Installation from PEAR does not works.
Code: Select all
~/projects/someproject$ symfony plugin-install http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1.2
>> plugin    installing plugin "http://plugi...om/sfPropelSqlDiffPlugin-0.1.2"
>> pear      downloading sfPropelSqlDiffPlugin-0.1.2.tgz ...
>> pear      Starting to download sfPropelSqlDiffPlugin-0.1.2.tgz (5,313
>> pear      bytes)
>> pear      ..
>> pear      ...done: 5,313 bytes
>> pear      symfony/sfPropelSqlDiffPlugin requires package
>> pear      "symfony/sfPropelSqlDiffPlugin" (version >= 0.8.1, version <=
>> pear      1.1.0, excluded versions: 1.1.0), downloaded version is 0.1.2
>> pear      No valid packages found

  [Exception]     
  install failed 
                 

Apply patch from http://trac.symfony-project.com/ticket/2837
develop7
Junior Member
 
Posts: 6
Joined: Thu Apr 19, 2007 10:38 am
Location: Belarus

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by divergent » Thu May 08, 2008 11:51 pm

the plugin doesn't seem to work with multiple databases - it generates inserts for the first database for all tables in the second database (even though they already exist in the other db). Is there any way around this or something additional I should do to keep the two dbs separate?
divergent
Member
 
Posts: 78
Joined: Wed May 31, 2006 9:40 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by jett » Tue May 27, 2008 4:04 pm

I ran into a small bug, wanted to post it here just in case...

After installing the plugin, I kept getting this error:

[SQLException]
Invalid resultset column: Create Table

I traced it to line 23 of dbInfo.php:

$create_table = $rs->getString("Create Table");

My RS object was actually returning "create table" as the column key and not "Create Table".

Changing it to this line fixes the problem:

$create_table = $rs->getString("create table");
jett
Junior Member
 
Posts: 3
Joined: Mon Nov 12, 2007 8:34 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by cokker » Fri Jun 20, 2008 9:08 am

Hi

I just tried your plugin and I think I found a bug. I use symfony 1.0.13 and installed this plugin by hand. I extraced the package and copied the file into the dirs.

When I run "symfony -T" no task was available. After I changed the name of sfPropelSqlDiffTask.php to sfPakePropelSqlDiffTask.php the task was displayed.

Further the project-dir wasn't correct. It seems that the constand SF_ROOT_DIR (line 32) is not correctly resolved. So the execute of the task failed.

After changing the line to:
Code: Select all
define('SF_ROOT_DIR', sfConfig::get('sf_root_dir'));

it worked.


Nevertheless great work. Thanks.

greet
Sven
cokker
Faithful Member
 
Posts: 591
Joined: Mon Jan 15, 2007 10:43 am
Location: Germany

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by ilyap » Tue Jul 22, 2008 7:17 am

I'm using symfony 1.0 with propel 1.3 plugin installed. Am I able to use this plugin? I think the answer is 'no', but just want to be sure :)~ :-)~ :smile:
ilyap
Junior Member
 
Posts: 4
Joined: Tue Jul 22, 2008 7:06 am
Location: Russia

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Tue Jul 22, 2008 12:06 pm

Yes, it dont work with propel 1.3, but it uses propel only for executing 3 queries, so you can fix it for propel 1.3, if you really need it
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by florynth » Wed Jul 23, 2008 1:21 pm

Another bug (not really a bug but still)

I just try to run it on a none modified schemas and I have this modification to make

Code: Select all
/* old definition: varchar(255) collate utf8_unicode_ci NOT NULL
   new definition: VARCHAR(255)  NOT NULL */
ALTER TABLE `sf_guard_group` CHANGE `name` `name` VARCHAR(255)  NOT NULL;



The problem is due to collate.

I don't know if there's a way to fix this with database definition or with another way.

Is this something you are aware of ?

I didn't check your code yet but I'll probably fix it myself in the next 2 months but if you could give me a track of where to look at first it will be great.
The best way to improve your Symfony knowledge is to read the source code !
When you start a project two main issues : database and security.
Sorry for my english, my first language is french.
Working for : http://www.tribalnova.com
florynth
Senior Member
 
Posts: 185
Joined: Wed Jan 17, 2007 10:06 pm
Location: Québec - Montréal

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Thu Jul 24, 2008 12:58 pm

I am going to fix this issue in nearest time
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by florynth » Thu Jul 24, 2008 1:02 pm

Thanks,

another thing I found,

If I change my database engine (let say that it was My Isam and I change it to InnoDB) It would be great to handle it ! But I know it's a weird and isolated case...

Is there a way to have a svn:external on your plugin ?

I found it much simplier to update but I didn't found it in the svn /plugins list of symfony...

Thanks again this is a really helpfull plugin

Martin
The best way to improve your Symfony knowledge is to read the source code !
When you start a project two main issues : database and security.
Sorry for my english, my first language is french.
Working for : http://www.tribalnova.com
florynth
Senior Member
 
Posts: 185
Joined: Wed Jan 17, 2007 10:06 pm
Location: Québec - Montréal

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Thu Jul 24, 2008 3:04 pm

florynth wrote: Is there a way to have a svn:external on your plugin ?

No, it isn't in symfony svn
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by krystianh » Fri Aug 01, 2008 2:02 pm

It's great plugin but today I found many bugs.

I haven't difference between my schema.xml and database and I run task symfony propel-build-sql-diff admin.
It generated diff.sql which have many lines with ADD INDEX, which there are in database yet...
f.e.
ALTER TABLE `file_data` ADD `INDEX` file_data_FI_1 (file_info_id);

Besides word INDEX have before and after char ', - it's bug.

Many times there is lines like this:
ALTER TABLE `ktr_mail` DROP `KEY`;
and
ALTER TABLE `ktr_object_changelog` CHANGE `CONSTRAINT` `CONSTRAINT` ktr_object_changelog_FK_2;
- it's bugs too.

Do you plan to repair it?
Best regards.
krystianh
Junior Member
 
Posts: 4
Joined: Fri Oct 19, 2007 10:55 am

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Fri Aug 01, 2008 2:51 pm

krystianh wrote: It's great plugin but today I found many bugs.


Which version of mysql do you using? Could you send to me output of "show create table" query for one of your tables?
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by krystianh » Fri Aug 01, 2008 3:00 pm

I use MySQL 5.0.51a-3ubuntu5.1

CREATE TABLE `ktr_config` (
`config_id` int(11) NOT NULL auto_increment,
`config_variable_name` varchar(50) NOT NULL,
`config_parameter_type_config_parameter_type_id` int(11) NOT NULL,
`config_parameter_show` int(11) NOT NULL default '1',
PRIMARY KEY (`config_id`),
UNIQUE KEY `uq_config` (`config_variable_name`),
KEY `ktr_config_FI_1` (`config_parameter_type_config_parameter_type_id`),
CONSTRAINT `ktr_config_FK_1` FOREIGN KEY (`config_parameter_type_config_parameter_type_id`) REFERENCES `ktr_config_parameter_type` (`config_parameter_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin
krystianh
Junior Member
 
Posts: 4
Joined: Fri Oct 19, 2007 10:55 am

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by krystianh » Tue Aug 12, 2008 4:36 pm

I consider this problem.
I had in propel.ini option propel.disableIdentifierQuoting set on true.
When I set this option on false is OK.
krystianh
Junior Member
 
Posts: 4
Joined: Fri Oct 19, 2007 10:55 am

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by zecho » Thu Sep 04, 2008 3:39 pm

When using --env="..." no matter what is the value set the result is the same:

>symfony propel:build-sql-diff --env="prod" frontend


The execution of task "propel:build-sql-diff" failed.
- Option "--env" requires an argument.
- Too many arguments ("propel:build-sql-diff prod frontend" given).


symfony propel:build-sql-diff [--env="..."] application

I tried with different values just for test but there were no success.
zecho
Junior Member
 
Posts: 4
Joined: Thu Sep 04, 2008 3:34 pm
Location: Bulgaria

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Thu Sep 04, 2008 6:39 pm

zecho wrote: When using --env="..." no matter what is the value set the result is the same:


It works for me. Which OS you are using? May be --env=prod without quotes?
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by zecho » Fri Sep 05, 2008 9:08 am

Sorry :)~ :-)~ :smile:

Just tested on lunux - it's working there
OS: Debian Lenny
symfony version 1.1.0 (/usr/share/php/symfony)

But on:
OS: Windows XP SP2
symfony version 1.1.1 (C:\xampp\php\PEAR\symfony)

On both places sfPropelSqlDiffPlugin is:
0.1.4-beta # plugins.symfony-project.org (symfony-plugins)

Regards,
Yanko Simeonoff

P.S. Tested with and without quotes. The results are the same.
zecho
Junior Member
 
Posts: 4
Joined: Thu Sep 04, 2008 3:34 pm
Location: Bulgaria