mirror of
https://github.com/go-vikunja/vikunja.git
synced 2026-03-09 07:13:35 -05:00
[SQLite] Users automatically deleted hour after 'vikunja restore' #117
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Frans-Willem on GitHub (Jan 4, 2023).
Description
Steps taken:
After having done some digging, I believe this is done here:
a4c85fed55/pkg/models/user_delete.go (L46)For some reason before doing a restore, 'SELECT * FROM Users WHERE deletion_scheduled_at NOT NULL;' returns no results, while after the restore it returns all users. Also, selecting for 'deletion_scheduled_at < time('now')' also returns the results:
It appears that before the restore, the deletion_scheduled_at field contains NULL, whereas after the restore the field contains an empty string (''). It appears NULL is translated to "" in the dump JSON, which is then translated to '' when restoring...
Vikunja Frontend Version
N/A
Vikunja API Version
20.1
Browser and version
N/A
Can you reproduce the bug on the Vikunja demo site?
No
Screenshots
No response
@Frans-Willem commented on GitHub (Jan 4, 2023):
Manually doing the following query in SQLite appears to be a possible band-aid:
Maybe a possible solution would be to iterate over all DATETIME fields in all tables after a restore and convert '' to NULL ?
I'm not sure why SQLite even allows empty strings as DATETIME :/
@kolaente commented on GitHub (Jan 5, 2023):
This has already been fixed in
fbc4b91e0f. The fix does pretty much what you described in your second comment.