-
-
Notifications
You must be signed in to change notification settings - Fork 95
Fix get or create module #722
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
base: main
Are you sure you want to change the base?
Fix get or create module #722
Conversation
…rom uniqueness filter and handling IntegrityError
|
My local uncommitted fix for this was Can you see if that works for you? I thought I fixed the mysql issue elsewhere, let me see if I can find it. |
📋 Background and Fix History (further context)
✅ SummaryThe problem started on SQLite, the fix solved it there, and migration to MySQL exposed the schema mismatch. We tested the suggested diff, but it failed with IntegrityErrors. The final patch matches the real DB constraint and works consistently across both backends. Verified cleanly on SQLite and MySQL. |
|
Can you try the current |
Fix duplicate insert error in get_or_create_module and improve MySQL compatibility
We encountered a reproducible error when running
patchman -aon SQLite:UNIQUE constraint failed: modules_module.name, modules_module.stream,
modules_module.version, modules_module.context, modules_module.arch_id
Root cause:
get_or_create_module()includedrepoin the uniqueness filter, causing duplicate insert attempts when multiple repos contained the same module metadata.Fix:
repofrom uniqueness filterAdditionally, MySQL migrations failed due to oversized indexes (utf8mb4 key length > 3072 bytes). We reduced CharField lengths and simplified unique_together in modules/models.py.
Impact:
patchman -aruns cleanly on SQLiteDiff summary:
modules/utils.py | 24 insertions(+), 35 deletions(-)
modules/models.py | 8 changes (field length adjustments, unique_together simplified)
Verification steps:
patchman -aon SQLite → completes without UNIQUE constraint error.python manage.py migrateon MySQL (utf8mb4) → schema builds cleanly.