| Re: Small fix for code [message #48380 is a reply to message #48376 ] |
Mon, 24 March 2008 13:10   |
yspro Messages: 19 Registered: March 2008 Location: Belarus::Minsk |
Junior Member |
|
|
You're right...
So look at:
<?php if($tabledata['keys']) {
foreach($tabledata['keys'] as $field=>$fielddata) {
$mycode = $fielddata['code'];
$otherdata = @$this->tables[$tablename]['keys'][$field];
$othercode = @$otherdata['code'];
if($mycode and !$othercode) {
if($otherdata['type']=='PRIMARY') { // <-----
$diff_sql .= "ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode;\n";
} else {
$diff_sql .= "ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX `$field` $mycode;\n";
}
}
}
} ?>
Maybe it should be:
<?php if($tabledata['keys']) {
foreach($tabledata['keys'] as $field=>$fielddata) {
$mycode = $fielddata['code'];
$otherdata = @$this->tables[$tablename]['keys'][$field];
$othercode = @$otherdata['code'];
if($mycode and !$othercode) {
if($fielddata['type']=='PRIMARY') {//if($otherdata['type']=='PRIMARY')
$diff_sql .= "ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode;\n";
} else {
$diff_sql .= "ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX `$field` $mycode;\n";
}
}
}
} ?>
[YS.PRO] blog
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48388 is a reply to message #43210 ] |
Mon, 24 March 2008 14:39   |
yspro Messages: 19 Registered: March 2008 Location: Belarus::Minsk |
Junior Member |
|
|
I hope this release would be stable )
[YS.PRO] blog
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48420 is a reply to message #43210 ] |
Mon, 24 March 2008 22:03   |
gray Messages: 30 Registered: January 2008 |
Member |
|
|
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)
[Updated on: Mon, 24 March 2008 22:15]
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48422 is a reply to message #43210 ] |
Mon, 24 March 2008 22:37   |
gray Messages: 30 Registered: January 2008 |
Member |
|
|
If you have isses with upgrading plugin please try command
symfony plugin-upgrade http://plugins.symfony-project.com/sfPropelSqlDiffPlugin-0.1.2
instead of
symfony plugin-upgrade http://plugins.symfony-project.com/sfPropelSqlDiffPlugin
I have posted ticket about it http://trac.symfony-project.com/ticket/3195
[Updated on: Mon, 24 March 2008 22:50]
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48453 is a reply to message #48422 ] |
Tue, 25 March 2008 11:01   |
yspro Messages: 19 Registered: March 2008 Location: Belarus::Minsk |
Junior Member |
|
|
I still have trouble with upgrading via cli:
>> 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
[Updated on: Tue, 25 March 2008 11:03] [YS.PRO] blog
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48457 is a reply to message #43210 ] |
Tue, 25 March 2008 12:10   |
yspro Messages: 19 Registered: March 2008 Location: Belarus::Minsk |
Junior Member |
|
|
<?php if($tabledata['keys']) foreach($tabledata['keys'] as $field=>$fielddata) {
$mycode = $fielddata['code'];
$otherdata = @$this->tables[$tablename]['keys'][$field];
$othercode = @$otherdata['code'];
if($mycode and !$othercode) {
if($fielddata['type']=='PRIMARY') {// was -->>> if($otherdata['type']=='PRIMARY') {
$diff_sql .= "ALTER TABLE `$tablename` ADD PRIMARY KEY $mycode;\n";
} else {
$diff_sql .= "ALTER TABLE `$tablename` ADD {$fielddata['type']} INDEX `$field` $mycode;\n";
}
};
}; ?>
[YS.PRO] blog
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #48462 is a reply to message #43210 ] |
Tue, 25 March 2008 13:37   |
yspro Messages: 19 Registered: March 2008 Location: Belarus::Minsk |
Junior Member |
|
|
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:
<?php //......
$i = new dbInfo();
$i->loadFromDb();
ob_start();
print_r($i);
file_put_contents('d:\db.txt', ob_get_contents());
ob_clean();
$i2 = new dbInfo();
$i2->loadAllFilesInDir(sfConfig::get('sf_data_dir').'/sql');
print_r($i2);
file_put_contents('d:\schema.txt', ob_get_contents());
ob_end_clean();
//....... ?>
[YS.PRO] blog
|
|
|
|
|
|
|
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #49555 is a reply to message #49457 ] |
Wed, 09 April 2008 13:52   |
pritam.gudekar Messages: 10 Registered: March 2008 |
Junior Member |
|
|
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 ->
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
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #49574 is a reply to message #49562 ] |
Wed, 09 April 2008 16:03   |
pritam.gudekar Messages: 10 Registered: March 2008 |
Junior Member |
|
|
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.....
thanx...
...pritam
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #49635 is a reply to message #49574 ] |
Thu, 10 April 2008 11:20   |
pritam.gudekar Messages: 10 Registered: March 2008 |
Junior Member |
|
|
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....
thanx...
...pritam
|
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #50478 is a reply to message #43210 ] |
Mon, 21 April 2008 12:48   |
develop7 Messages: 6 Registered: April 2007 Location: Belarus |
Junior Member |
|
|
Installation from PEAR does not works.
~/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
[Updated on: Mon, 21 April 2008 13:04]
|
|
|
|
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #56824 is a reply to message #56688 ] |
Wed, 23 July 2008 13:21   |
florynth Messages: 185 Registered: January 2007 Location: Québec - Montréal |
Senior Member |
|
|
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
/* 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
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #56931 is a reply to message #56930 ] |
Thu, 24 July 2008 13:02   |
florynth Messages: 185 Registered: January 2007 Location: Québec - Montréal |
Senior Member |
|
|
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
|
|
|
|
|
|
|
|
|
| Re: new plugin sfPropelSqlDiffPlugin - build diff sql [message #60208 is a reply to message #60177 ] |
Thu, 04 September 2008 18:39   |
gray Messages: 30 Registered: January 2008 |
Member |
|
|
| zecho wrote on Thu, 04 September 2008 15:39 | 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?
[Updated on: Thu, 04 September 2008 18:40]
|
|
|
|