baimard / gestion

https://baimard.github.io/gestion
GNU Affero General Public License v3.0
73 stars 9 forks source link

Cant upgrade to 2.5.0 beta / 2.5.1 release #387

Open f4grx opened 6 months ago

f4grx commented 6 months ago

Describe the bug Cant upgrade to 2.5.0

To Reproduce Steps to reproduce the behavior:

  1. enable beta channel in nextcloud admin settings
  2. version 2.5.0 appears in update list
  3. click update app
  4. an error appears:

Database error when running migration 20300Date20230714134445 for app gestion An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: oc_gestion_client.id_configuration could not enable apps

Expected behavior app updates to 2.5

Desktop (please complete the following information): not relevant (server problem) - debian 12 accessing nextcloud via web interface in firefox

Additional context I'm using the sqlite backend Nextcloud instance gets broken until I disable the gestion app in command line In addition, going back to nextcloud stable release channel and re-enabling gestion, the app is still broken with the same error message.

f4grx commented 6 months ago

Hello, Thank you very much for publishing a new release.

however this table migration error is still present when trying to install the new 2.5.1 release on top of the old one.

Can you tell me what sql commands I should run to update my db? I'm really sorry to bother you, this is not really a bug but a migration issue.

baimard commented 6 months ago

I'm currently searching for the problem.

f4grx commented 6 months ago

I'm available if you want me to run some sql and report results. My DB is a sqlite.

if that helps:

sqlite> .schema oc_gestion_client CREATE TABLE oc_gestion_client (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, nom CLOB NOT NULL, prenom CLOB NOT NULL, legal_one CLOB NOT NULL, entreprise CLOB NOT NULL, telephone CLOB NOT NULL, mail CLOB NOT NULL, adresse CLOB NOT NULL, id_nextcloud VARCHAR(64) NOT NULL);

there is no id_configuration field.

Did you forget to add a file in apps/gestion/lib/Migration?

Looks like this was not executed: https://github.com/baimard/gestion/blob/master/lib/Migration/Version20300Date20230714134445.php#L115

I did that:

sqlite> ALTER TABLE oc_gestion_client ADD id_configuration integer(11);
sqlite> .schema oc_gestion_client 
CREATE TABLE oc_gestion_client (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, nom CLOB NOT NULL, prenom CLOB NOT NULL, legal_one CLOB NOT NULL, entreprise CLOB NOT NULL, telephone CLOB NOT NULL, mail CLOB NOT NULL, adresse CLOB NOT NULL, id_nextcloud VARCHAR(64) NOT NULL, id_configuration integer(11));

The error then changed to the table devis, so I added:

sqlite> ALTER TABLE oc_gestion_devis ADD id_configuration integer(11);
sqlite> ALTER TABLE oc_gestion_facture ADD id_configuration integer(11);
sqlite> ALTER TABLE oc_gestion_produit ADD id_configuration integer(11);
sqlite> ALTER TABLE oc_gestion_produit_devis ADD id_configuration integer(11);

And then I could install the app.

So you have an upgrade problem in the path 2.3.1->2.5.1

baimard commented 21 hours ago

is it solved ?