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

Add database consistency checks #837

Merged
merged 2 commits into from
Mar 8, 2025

Conversation

tchoutri
Copy link
Contributor

@tchoutri tchoutri commented Mar 7, 2025

Proposed changes

The messages look like this:

2025-03-07 12:13:41 ATTENTION flora-server: Database validation failed! Expected tables are missing: affected_packages, affected_version_ranges, blob_relations, categories, downloads, oddjobs, organisations, package_categories, package_components, package_group_packages, package_groups, package_indexes, package_publishers, packages, persistent_sessions, releases, requirements, security_advisories, user_organisation, users.

2025-03-07 12:13:41 ATTENTION flora-server: Database validation failed! Unexpected tables are present: toto.

Contributor checklist

@tchoutri tchoutri force-pushed the flora-242-database-table-consistency-checks branch from 6b0f833 to 015117e Compare March 7, 2025 12:14
@tchoutri tchoutri requested a review from mau5mat March 7, 2025 12:17
Comment on lines +89 to +97
SELECT table_name
FROM information_schema.tables
WHERE table_name <> 'schema_migrations'
AND table_type = 'BASE TABLE'
AND EXISTS (SELECT TRUE
FROM unnest(current_schemas(FALSE)) AS cs
WHERE cs = table_schema)
ORDER BY table_name ASC
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the workhorse of the feature

@tchoutri tchoutri force-pushed the flora-242-database-table-consistency-checks branch from e275cc0 to 698a852 Compare March 7, 2025 12:19
Copy link
Contributor

@mau5mat mau5mat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was a lot to unpack here for me personally, but I took some time to figure out the bits I didn't understand.

I think this looks grand, good to go 👍

@tchoutri tchoutri merged commit 83691cb into development Mar 8, 2025
11 checks passed
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

Successfully merging this pull request may close these issues.

Database table consistency checks
2 participants