View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - Database update - ProjeQtOr
 
 

Database update

More
19 Mar 2013 10:31 #1 by eB0Z
Database update was created by eB0Z
Hello Babynus,

I would update my database when I want.
So I would go through the sql files.

For that, I added a variable in parameters.php

parameters.php
$forceToUpdate = false;//or true to force the update

Then I added a condition in projector.php

projector.php
if (Sql::getDbVersion()!=$version or $forceToUpdate) {
    $prf=new Profile($user->idProfile);
    if ($prf->profileCode!='ADM') {
      loginErrorMaintenance();
      exit;
    }
    include "../db/maintenance.php";
    exit;
}

I also changed the version (text) in projector.php to be sure that it will not be the same as the version stored in the parameter's table (db) and added the SQL file in maintenance.php too.

My problem is that it does not go in the last sql files I added.
In fact, it does not execute the script.
To test I have created a sql file with a table creation inside, and after the update (forced), my table has not been created...

How can I do for that ?
Does it go through my sql file without executing the scripts ?

I hope I have been enough clear.

Thank you.

Antoine.

Please Log in or Create an account to join the conversation.

More
19 Mar 2013 14:04 #2 by babynus
Replied by babynus on topic Re: Database update
Your parameter $forceToUpdate is not really usefull.

what you need to update is :
- create new /db/Projector_Vx.y.z.sql
- add your new version "Vx.y.z" in $versionHistory (an array) in /db/maintenance.php
(I think it is this step that is missing)
- change $version="Vx.y.z" in /tool/projector.php
This is all.
It will work correctly.

Then, if you want to run again your script, change parameterValue of table parameter, for parameterCode='dbVersion', to the old version.
This is important as the tool will apply scripts from this version to $version.
So $forceToUpdate is no use. If you only set it, the tool does not apply any script (none exists from 'dbVersion' to $version as they are equal)

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
19 Mar 2013 14:16 #3 by eB0Z
Replied by eB0Z on topic Re: Database update
Thank you for your answer.
Yes I knew that I could do by this way, but I wanted something without changing the version.
Anyway, I am going to do like that.
Regards.

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.031 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.