Skip to content
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

SQLITE_CONSTRAINT: FOREIGN KEY constraint failed #3761

Closed
2 tasks done
MisterCT42 opened this issue Sep 18, 2023 · 10 comments
Closed
2 tasks done

SQLITE_CONSTRAINT: FOREIGN KEY constraint failed #3761

MisterCT42 opened this issue Sep 18, 2023 · 10 comments

Comments

@MisterCT42
Copy link

MisterCT42 commented Sep 18, 2023

⚠️ Please verify that this bug has NOT been raised before.

  • I checked and didn't find similar issue

🛡️ Security Policy

Description

I saw that there was a new version so I did the described steps: https://github.com/louislam/uptime-kuma/wiki/%F0%9F%86%99-How-to-Update

But after updating everything was gone.. thankfully I made a backup right before updating. But the restore is showing this error:
2023-09-18 16_14_16-Uptime Kuma and 12 more pages - Work - Microsoft​ Edge

👟 Reproduction steps

Restore backup after updating to latest version.

👀 Expected behavior

Restore the backup with all my monitors

😓 Actual Behavior

Error popup message that show: insert into monitor_notification (monitor_id, notification_id) values (11, '7') - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed

🐻 Uptime-Kuma Version

1.23.2

💻 Operating System and Arch

Portainer

🌐 Browser

Chrome

🐋 Docker Version

Latest

🟩 NodeJS Version

Latest

📝 Relevant log output

No response

@MisterCT42 MisterCT42 added the bug Something isn't working label Sep 18, 2023
@chakflying
Copy link
Collaborator

Please do not use the deprecated json backup feature.

If your previous data is missing after updating to 1.23, its likely due to a previously misconfigured data path. Please read this issue to check if you are affected and the solution to restore the old data: #3714 (comment)

@louislam louislam added help and removed bug Something isn't working labels Sep 19, 2023
@louislam
Copy link
Owner

Change to help as the backup feature is unmaintained and deprecated already.

Copy link

We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.

@github-actions github-actions bot added the Stale label Dec 18, 2023
Copy link

This issue was closed because it has been stalled for 2 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2023
@hvspa
Copy link

hvspa commented Oct 16, 2024

hello,
i am on .23 version, and was trying to backup restore with override option and got all my monitors deleted. are there any ways to restore them? maybe something to drop the database and have it re-created? or downgrade to older version restore there and upgrade?

now getting error

 insert into monitor_notification (monitor_id, notification_id) values (2, '1') - SQLITE_CONSTRAINT: FOREIGN KEY constraint failed

thanks

@CommanderStorm
Copy link
Collaborator

was trying to backup restore with override option and got all my monitors deleted. Are there any ways to restore them?

What did you do precicely?

@hvspa
Copy link

hvspa commented Oct 16, 2024

what i did is i exported the config, copy pasted one of the monitors' json, replaced the ID-s (+1 to the highest ID) and imported back with override option selected. then it started to complain about foreign keys. tried to import the original json, still same complaint, then wiped the databases, still same complaint about foreign keys

@hvspa
Copy link

hvspa commented Oct 16, 2024

what i did now, i deleted the kuma.db file, and then restarted the deployment, then imported the json again, and monitors appeared, but

  1. they are not in groups, grouping them manually
  2. my grpc monitors are down and UI does not allow me to edit them, when i click on them, nothing happen in the right frame of UI

@CommanderStorm
Copy link
Collaborator

Sorry to say, but the backup functionality is deprecated for a reason.
We recomend you to just backup the database instead in the UI.

Given that you deleted the db, there is nothing that can be fixed.

Things like groups, status pages, maintenances or the grpc monitor never got fully adopted into that feature.
The feature has been dropped in v2.0 (#4500)

If you want to import existing data sources of monitors, please use a third party tooling like AutoKuma or https://uptime-kuma-api.readthedocs.io/ instead

@hvspa
Copy link

hvspa commented Oct 16, 2024

Sorry to say, but the backup functionality is deprecated for a reason. We recomend you to just backup the database instead in the UI.

Given that you deleted the db, there is nothing that can be fixed.

Things like groups, status pages, maintenances or the grpc monitor never got fully adopted into that feature. The feature has been dropped in v2.0 (#4500)

If you want to import existing data sources of monitors, please use a third party tooling like AutoKuma or https://uptime-kuma-api.readthedocs.io/ instead

thanks for the links, this will be indeed useful. ended up re-creating some kafka monitors, manually adding the grpc monitors' proto-s, some postgres connection strings, but the main monitors got recovered on a blank database, which was a day saver.
thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants