mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 23:15:49 +03:00
[GH-ISSUE #1123] NOT NULL constraint failed: api_check.badge_key #780
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#780
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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 @fertek on GitHub (Feb 9, 2025).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/1123
Hi,
I deployed the Healthchecks application (
v3.9) on anUbuntu 24.04.1 LTSserver following https://healthchecks.io/docs/self_hosted/ (without Docker) and everything works fine. However, when I click onAdd Check, fill out the form and clickSave, I get a 500 error. In https://health.example.com/admin/logs/, the event is logged as follows:This is the content of the
.envfile:I use SQLite as database and all migrations have been applied via
./manage.py migrate.Thanks for your help.
@cuu508 commented on GitHub (Feb 9, 2025):
Thanks for the report.
I added the NOT NULL constraint on December 27, but released the v3.9 on December 20. Did you perhaps run a git master version or a nightly image at some point with the same database? If you backup and remove the database file, and run the migrations again to create a fresh database, can you still reproduce the problem?
@fertek commented on GitHub (Feb 9, 2025):
Thanks for the lightning-fast response, that was it! After
git clone ...I didgit checkout v3.9.So
git checkout masterandsystemctl restart healthchecks.servicefixed the error, and I can create new Checks now.@Marcool04 commented on GitHub (Jan 24, 2026):
I think I have managed to get myself in a similar type of situation. As we discussed previously in another issue https://github.com/healthchecks/healthchecks/issues/1231 I must have run 3.10 for a time, and now I am back on the latest available packaged 3.9 (on Arch Linux, held back waiting for Django to be updated), but when I try to add a new channel, I get this error:
I wonder if there is any relatively simple way for me to fix this hc.sqlite file which I appear to have damaged somehow, most likely by running a more recent version, then going back? As you said, with a clean, new database, the problem just goes away. But as I have quite a few checks which took a while to set up and tune, I would like to ask if there is maybe a solution to not have to restart from scratch? I don't see a method to export / reimport checks is there? Or a way to migrate from an old sqlite db to a newer one? Otherwise I'd be happy to manually edit the sqlite file if it's a pretty simple fix to make?
Any help or suggestions would be much appreciated. Cheers, Mark.
@cuu508 commented on GitHub (Jan 25, 2026):
The safest way would be to use Django's
manage.py migratecommand to reverse the database migrations that came after 3.9. The command to do this would be:(
0115_flip_api_flip_owner_createdwas the last migration before the v3.9 release).This command needs to be run on the more recent Healthchecks codebase you were running before (3.10?). It will not work on 3.9 – the migrations you need to reverse don't yet exist in 3.9.
In any case, make a copy of the sqlite file and keep it safe in case anything goes wrong.
@Marcool04 commented on GitHub (Jan 25, 2026):
Wow! Amazing, that worked just fine! Thank you so so much for your amazing support for this really useful tool 🙏