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

Database issues, migrations not run #449

Open
ctron opened this issue Jun 24, 2024 · 8 comments
Open

Database issues, migrations not run #449

ctron opened this issue Jun 24, 2024 · 8 comments

Comments

@ctron
Copy link
Contributor

ctron commented Jun 24, 2024

After updating my demo system, I noticed that the advisories table no longer works. Fetching the data results in (500):

{
  "error": "Database error",
  "message": "Query Error: error returned from database: column \"score\" does not exist"
}

I didn't further investigate. So I don't know if this is a UI issue or a backend issue (or both).

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

cc @carlosthe19916

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

I noticed other views failing as well:

  • SBOMs:

    Query Error: error returned from database: column sbom_package.version does not exist
    
  • Vulnerabilities:

    Query Error: error occurred while decoding column "advisory_id": mismatched types; Rust type `core::option::Option<uuid::Uuid>` (as SQL type `UUID`) is not compatible with SQL type `INT4`
    

@carlosthe19916
Copy link
Member

I have the latest version locally working and I do not see those issues.

  • Taking the risk of being wrong I bet those errors will be gone if you delete the .trustify directory and start the backend.

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

That might be the case. The instance is using an external database. I would expect that to "migrate" to the newest schema. I'll try check if that's indeed the case.

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

Resetting the database partially solved this. The advisories still fail with the same error.

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

However it also looks like as if the importers fail with similar errors now.

@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

Ok, it might be a mix of "did not run migrations" and PEBKAC: I ran the migrations with the old container.

The real issue seems to me that we did not properly use migrations. So the migrations were assumed to be applied, while in fact that are not.

@ctron ctron changed the title UI fails to show advisories Database issues, migrations not run Jun 24, 2024
@ctron
Copy link
Contributor Author

ctron commented Jun 24, 2024

Ok, so having worked around all the issues (like full disk, wrong migration) I still had to wipe the database for the upgrade.

So @carlosthe19916 you had been right, it was a stale database issue. I guess we need to work on migrations.

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

No branches or pull requests

2 participants