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: new plugin sfPropelSqlDiffPlugin - build diff sql

by toubsen » Tue Sep 09, 2008 4:05 pm

Here's a quick fix for the "collate xyz" bug with mysql:

dbInfo.php -> line 61:
Code: Select all
// OLD:
// $code = $matches[2];

//NEW:
$code = preg_replace('/collate [\w_]+/', '', $matches[2]);
toubsen
Junior Member
 
Posts: 4
Joined: Tue Mar 25, 2008 4:22 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by mikecrowe » Thu Sep 25, 2008 12:42 am

Update: Needs a little more work -- will provide shortly.

For those using SF 1.1 and Propel 1.3, the attached diff allows you to support multiple schema's with multiple databases (I hope). Works for me.
Cheers!
Mike

From despair.com:
INSPIRATION: Genius is 1% inspiration and 99% perspiration...
which explains why engineers smell so bad...
mikecrowe
Junior Member
 
Posts: 27
Joined: Fri Aug 25, 2006 9:48 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by volod » Sat Dec 13, 2008 10:35 am

Hello,

plugin is not available at http://svn.symfony-project.com/plugins/sfPropelSqlDiffPlugin
was it moved somewhere?

Thanks!
volod
Member
 
Posts: 85
Joined: Wed Jun 25, 2008 7:00 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Sat Jan 03, 2009 3:55 pm

Version for symfony 1.2 is available now, thanks to Vladimir Bilyov.

plugin is not available at http://svn.symfony-project.com/plugins/sfPropelSqlDiffPlugin
was it moved somewhere?


Now it is available here.
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by volod » Sat Jan 03, 2009 4:39 pm

gray wrote: Version for symfony 1.2 is available now, thanks to Vladimir Bilyov.


Gray, thank you for your work :)~ :-)~ :smile:
volod
Member
 
Posts: 85
Joined: Wed Jun 25, 2008 7:00 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Thu Apr 16, 2009 3:10 pm

new release available - 0.2.0

Changelog:
* multiple databases support
* don't create foreign keys on myisam and ndbcluster tables
* task propel:build-all-diff now runs also propel:build-filters and propel:build-forms
* ignore views when building database patch
* license change: MIT -> LGPL
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by raj1965 » Tue May 12, 2009 3:51 pm

hi,

i want to be able to check out the trunk of my project, work on it, edit the schema, etc, and then have a way of recording changes made to the database before I commit.

Has anyone any idea how i could do this? This plugin is almost what I want, but in reverse, i.e. i want to be able to take an old schema file and look at a database, and get some sql that would bring a database using the old schema up-to-date with the new db.

thanks,
raj
raj1965
Junior Member
 
Posts: 25
Joined: Wed Apr 01, 2009 2:25 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by florynth » Tue May 12, 2009 3:55 pm

You just have to run the

symfony propel-build-sql-diff [application_name]

And it will generate a diff.slq file that you'll copy and commit it somewhere
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 raj1965 » Tue May 12, 2009 5:20 pm

oh yeah. thanks.
raj1965
Junior Member
 
Posts: 25
Joined: Wed Apr 01, 2009 2:25 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by gray » Tue May 12, 2009 5:58 pm

take a look at built-in task propel:build-schema
gray
Member
 
Posts: 30
Joined: Thu Jan 10, 2008 7:50 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by cancausecancer » Fri Jul 17, 2009 11:03 am

I modified the plugin to add foreign key checking for columns which already exist in the db and have mismatched column types which keep foreign keys from being built or keeps column types from being changed.

If the column types are different for the fkey'd column and foreign table's column, it fixes it by dropping the fkey, changing the fkey column type to match the foreign table's type and then adding the fkey back.

Don't use this version unless you are having problems being unable to make foreign keys or being unable to change column types because the tables have foreign keys already and their types don't match.

I've ran it on my db more than 50 times and it works for my db with 100s of tables. It's use at your own risk and make sure to back up any vital data and your old version of the plugin too just for safety.
Attachments
sfPropelSqlDiffPlugin - jeck lamnent.zip
(9.88 KiB) Downloaded 1115 times
I have to code in other langs besides what I use at work because work is lowering my iq.
cancausecancer
Junior Member
 
Posts: 9
Joined: Thu Jan 29, 2009 4:04 pm
Location: The marble

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by omansour » Mon Aug 24, 2009 3:36 pm

Hey

Using your plugin in our big symfony project I found some bugs on default value and null detection.
Here the patch I have created for the 1.2 version.

best regards
Olivier
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

omansour
Junior Member
 
Posts: 3
Joined: Tue Aug 22, 2006 2:56 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by vojta.jina » Sun Aug 30, 2009 12:09 am

When I run the propel:build-sql-diff, it creates whole schema...
The problem is, that it does not load anything from db.

When I try to execute some basics Propel commands inside sfPropelBuildSqlDiffTask->execute(), like:
MyClassPeer::doSelect(new Criteria()), its working...

But dbInfo->loadFromDb() returns false...
Do you have any ideas, what could be the problem ?

Thanks a lot.
V.
vojta.jina
Member
 
Posts: 62
Joined: Tue Nov 04, 2008 9:49 pm
Location: Czech Republic

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by cancausecancer » Wed Sep 02, 2009 10:10 pm

>When I run the propel:build-sql-diff, it creates whole schema...
>The problem is, that it does not load anything from db.

Do the tables exist in the DB? Is it looking at the correct DB name?

You may have to execute the sql diff file so it creates the DB in MySQL. I believe propel:insert-sql-diff will do that. You would have to run it after you build-diff. If that is what you need, you can also go to the /data/sql/ folder and find the diff.sql (or propel.diff.sql in the new version) and execute that on the server. That sql file is the resulting sql from the sql-diff.
I have to code in other langs besides what I use at work because work is lowering my iq.
cancausecancer
Junior Member
 
Posts: 9
Joined: Thu Jan 29, 2009 4:04 pm
Location: The marble

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by vojta.jina » Thu Sep 03, 2009 4:47 pm

Here is the begining of the execute() code:
Code: Select all
    $databaseManager = new sfDatabaseManager($this->configuration);
    $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
       
    $buildSql = new sfPropelBuildSqlTask($this->dispatcher, $this->formatter);
    $buildSql->setCommandApplication($this->commandApplication);
    $buildSql->run();

    $this->logSection("sql-diff", "building database patch");
   
    $i = new dbInfo();
    $i->loadFromDb(Propel::getConnection($options['connection']));


$buildSql->run() works fine. It creates SQL of the schema.yml.

$databaseManager is connected right, because when I try something like this, it works:
Code: Select all
$items = SomePeer::doSelect(new Criteria());


The problem is, that dbInfo ($i) does load nothing !
When I send the $connection, still nothing:
Code: Select all
$i->loadFromDb($connection);


On my local machine (Win XP, MySQL: 5.0.77-community-nt) everything works fine.
But on a server (Debian/GNU Linux, MySQL: 5.0.32-Debian_7etch5-log)
vojta.jina
Member
 
Posts: 62
Joined: Tue Nov 04, 2008 9:49 pm
Location: Czech Republic

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by Vengeance » Sun Dec 20, 2009 12:03 am

vojta.jina I have the same problem.

I checked that "if($stmt->rowCount()==0) return false;" in dbInfo.php:13 always returns FALSE even though the query is performed well. When this comment out, the script works
Vengeance
Junior Member
 
Posts: 8
Joined: Wed May 30, 2007 10:44 am
Location: Lodz, Poland

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by JackJones » Mon Jan 18, 2010 4:41 pm

Hi All

Seems to be a very nice plugin.
I have some problem's with the installation, what is the best whay to install it ?

Thx
JackJones
Member
 
Posts: 67
Joined: Thu Feb 08, 2007 6:42 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by mkwa72 » Tue May 15, 2012 2:33 pm

Vengeance wrote:I checked that "if($stmt->rowCount()==0) return false;" in dbInfo.php:13 always returns FALSE even though the query is performed well. When this comment out, the script works


This bug is still not fixed in version 0.3.1 (released 25/02/2011).
mkwa72
Junior Member
 
Posts: 1
Joined: Tue May 15, 2012 2:30 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by woolfas » Wed Jul 18, 2012 5:49 pm

Thanks for the plugin!
User avatar
woolfas
Member
 
Posts: 61
Joined: Mon Nov 08, 2010 2:31 pm
Location: Lithuania

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by enigmatiqk » Fri Jul 27, 2012 6:18 pm

mkwa72 wrote:
Vengeance wrote:I checked that "if($stmt->rowCount()==0) return false;" in dbInfo.php:13 always returns FALSE even though the query is performed well. When this comment out, the script works


This bug is still not fixed in version 0.3.1 (released 25/02/2011).


why do not use propelorm diff ?
enigmatiqk
Junior Member
 
Posts: 4
Joined: Mon Nov 29, 2010 3:23 pm

Re: new plugin sfPropelSqlDiffPlugin - build diff sql

by jackbarxiao » Tue Dec 17, 2013 11:17 am

something like that.
jackbarxiao
Junior Member
 
Posts: 1
Joined: Tue Dec 17, 2013 11:15 am