Le Mardi 31 Juillet 2007 13:12, Dany De Bontridder a écrit :
| Alain Vaugham writes:
| > #cat /var/www/phpcompta/html/admin/sql/patch/upgrade30.sql begin ;
| > alter table jrn_def drop constraint "$1";
| >
| > update jrn_action set ja_jrn_type='ODS' where ja_jrn_type='OD ';
| > update jrn_def set jrn_def_type='ODS' where jrn_def_type = 'OD ';
| > update jrn_type set jrn_type_id='ODS' where jrn_type_id ='OD ';
| >
| > alter table jrn_action add constraint "$1" foreign key (ja_jrn_type)
| > references jrn_type(jrn_type_id);
| >
| > alter table jrn_def add constraint "$1" FOREIGN KEY (jrn_def_type)
| > REFERENCES jrn_type(jrn_type_id);
| > update version set val=31;
| > commit;
|
| Bon ben, apparemment les constraintes ne sont pas les même sur la BD belge
| et française tu peux supprimer l'autre ligne : alter table jrn_def drop
| constraint "$1";
|
| Heureusement, que si l'opération ne fonctionne pas, la totalité est
| annulée, on ne risque pas d'ajouter d'incohérence ;)
|
Là, on dirait que ça s'aggrave :
[...]
Congratulation : Test successfull
Patching databases
Patching Alka 2006 from the version 30 to the version 30 begin ;
update jrn_action set ja_jrn_type='ODS' where ja_jrn_type='OD ';
update jrn_def set jrn_def_type='ODS' where jrn_def_type = 'OD ';
update jrn_type set jrn_type_id='ODS' where jrn_type_id ='OD ';
alter table jrn_action add constraint "$1" foreign key (ja_jrn_type)
references jrn_type(jrn_type_id);
Warning: pg_query() [function.pg-query]: Query failed: ERREUR: il n'existe
aucune contrainte correspondant aux clés données pour la table
référencée «jrn_type» in /var/www/phpcompta/include/postgres.php on line
133
ERROR : alter table jrn_action add constraint "$1" foreign key (ja_jrn_type)
references jrn_type(jrn_type_id)
Voici ce que j'ai fait sur le serveur :
# vim /var/www/phpcompta/html/admin/sql/patch/upgrade30.sql
# chown -R www-data:www-data /var/www/
# /etc/init.d/postgresql-8.1 restart
Restarting PostgreSQL 8.1 database server: main.
# /etc/init.d/apache2 restart
Forcing reload of web server (apache2)....
# cat /var/www/phpcompta/html/admin/sql/patch/upgrade30.sql
begin ;
update jrn_action set ja_jrn_type='ODS' where ja_jrn_type='OD ';
update jrn_def set jrn_def_type='ODS' where jrn_def_type = 'OD ';
update jrn_type set jrn_type_id='ODS' where jrn_type_id ='OD ';
alter table jrn_action add constraint "$1" foreign key (ja_jrn_type)
references jrn_type(jrn_type_id);
alter table jrn_def add constraint "$1" FOREIGN KEY (jrn_def_type) REFERENCES
jrn_type(jrn_type_id);
update version set val=31;
commit;