-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cospend update not working #328
Comments
Which database system are you using? Mysql/Mariadb, Postgres? It is supposed to be an unsigned int with NotNull set to false and a default value set to 0. If you're using Postgres, could you try to run this database query? On my side, no such thing has ever happened with MariaDB or Sqlite. |
Hi @julien-nc! ❯ sudo mycli
Connecting to socket /var/run/mysqld/mysqld.sock, owned by user mysql
MariaDB 10.11.6
mycli 1.26.1
Home: http://mycli.net
Bug tracker: https://github.com/dbcli/mycli/issues
Thanks to the contributor - QiaoHou Peng
MariaDB root@(none):(none)> use nextcloud
You are now connected to database "nextcloud" as user "root"
Time: 0.000s
MariaDB root@(none):nextcloud> show columns from oc_cospend_bills
+-------------------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+---------------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | <null> | auto_increment |
| projectid | varchar(64) | NO | | <null> | |
| what | varchar(300) | NO | | <null> | |
| amount | double | NO | | <null> | |
| payerid | int(11) | NO | | <null> | |
| repeat | varchar(1) | NO | | n | |
| categoryid | int(11) | YES | | <null> | |
| paymentmode | varchar(1) | YES | | <null> | |
| lastchanged | bigint(20) unsigned | NO | | 0 | |
| repeatallactive | int(11) | NO | | 0 | |
| repeatuntil | varchar(20) | YES | | <null> | |
| timestamp | bigint(20) unsigned | NO | | 0 | |
| comment | varchar(300) | YES | | <null> | |
| repeatfreq | int(11) | NO | | 1 | |
| paymentmodeid | int(11) | NO | | 0 | |
| deleted | int(11) | NO | | 0 | |
| project_id | varchar(64) | YES | | <null> | |
| payer_id | bigint(20) unsigned | YES | | <null> | |
| category_id | bigint(20) | YES | | <null> | |
| payment_mode_id | bigint(20) unsigned | YES | | 0 | |
| payment_mode | varchar(1) | YES | | <null> | |
| last_changed | bigint(20) unsigned | NO | | 0 | |
| repeat_all_active | int(11) | NO | | 0 | |
| repeat_until | varchar(20) | YES | | <null> | |
| repeat_frequency | int(11) | NO | | 1 | |
+-------------------+---------------------+------+-----+---------+----------------+ Sorry for not giving details about the DB in the first place! |
Hi,
|
@julien-nc is there anything that I can test to try to investigate this pb? Do you have any suggestion on how we could rollback to the previous version (replacing the directory in |
@fauust The migration is trying to transfer the data from the So I guess you could check if there is a negative value in @prismplex About SELECT projectid from oc_cospend_bills GROUP BY projectid; Also, @prismplex On which migration step are you getting the warning? Look for something like |
Yep that was it, there was some negative value (-1) on old UPDATE oc_cospend_bills SET paymentmodeid = 0 WHERE paymentmodeid < 0; And then I could proceed to the upgrade, thanks a lot for this great app! |
After executing
I get: After executing
That is the error I get:
|
Thank you @fauust for sharing your solution! I had the exact same problem and was able to solve it the same way ;). |
@prismplex The problem is that we are trying to set Let's double check: SELECT count(*) FROM oc_cospend_bills WHERE project_id IS NULL; Let's check the others: SELECT count(*) FROM oc_cospend_members WHERE project_id IS NULL;
SELECT count(*) FROM oc_cospend_shares WHERE project_id IS NULL;
SELECT count(*) FROM oc_cospend_categories WHERE project_id IS NULL;
SELECT count(*) FROM oc_cospend_paymentmodes WHERE project_id IS NULL;
SELECT count(*) FROM oc_cospend_currencies WHERE project_id IS NULL; A fix would be to either set a project id for those broken rows or delete them if they make no sense. Worst case scenario would be that the data transfer has failed and a lot (or all) the rows of those tables have a NULL project_id. In this case you would need to manually set the project_id value everywhere. |
the other commands return the following:
Thank you for your help! |
@prismplex Wow that is very unexpected.
SELECT count(*) FROM oc_cospend_categories WHERE project_id IS NOT NULL;
SELECT projectid FROM oc_cospend_members LIMIT 1;
SELECT projectid FROM oc_cospend_shares LIMIT 1;
SELECT projectid FROM oc_cospend_categories LIMIT 1;
SELECT projectid FROM oc_cospend_paymentmodes LIMIT 1; or SHOW COLUMNS FROM oc_cospend_members;
SHOW COLUMNS FROM oc_cospend_shares;
SHOW COLUMNS FROM oc_cospend_categories;
SHOW COLUMNS FROM oc_cospend_paymentmodes;
SELECT * FROM oc_migrations WHERE app="cospend";
Depending on the state of your DB it might be possible to run some migration steps again or manually fix the data to allow running the step that fails for you (030007Date20241225163007). |
Hi, I am trying to update the cospend app to the latest version (3.0.8) and there seem to be a DB error, see below:
NC running in docker, version 30.0.4.
The text was updated successfully, but these errors were encountered: