[PR #20681] [CLOSED] Closes #12318: Ignore case when determining uniquess of name & slug fields #16008

Closed
opened 2025-12-30 00:25:17 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20681
Author: @jeremystretch
Created: 10/24/2025
Status: Closed

Base: featureHead: 12318-case-insensitive-uniqueness


📝 Commits (4)

  • dac0a06 Introduce case-insensitive collations
  • 06052f8 Use case-insensitive collations on fields considered for uniqueness
  • a345533 Add migrations to remove indexes and alter field collations
  • 4f2f61c Reindex migrations

📊 Changes

39 files changed (+1083 additions, -81 deletions)

View changed files

netbox/circuits/migrations/0053_ci_collations.py (+97 -0)
📝 netbox/circuits/models/circuits.py (+3 -2)
📝 netbox/circuits/models/providers.py (+8 -5)
📝 netbox/circuits/models/virtual_circuits.py (+3 -2)
netbox/core/migrations/0020_ci_collations.py (+30 -0)
📝 netbox/core/models/data.py (+2 -1)
netbox/dcim/migrations/0217_ci_collations.py (+26 -0)
netbox/dcim/migrations/0218_ci_collations.py (+311 -0)
📝 netbox/dcim/models/device_component_templates.py (+1 -1)
📝 netbox/dcim/models/device_components.py (+1 -1)
📝 netbox/dcim/models/devices.py (+11 -12)
📝 netbox/dcim/models/modules.py (+4 -2)
📝 netbox/dcim/models/power.py (+2 -2)
📝 netbox/dcim/models/racks.py (+5 -3)
📝 netbox/dcim/models/sites.py (+4 -3)
netbox/extras/migrations/0134_ci_collations.py (+114 -0)
📝 netbox/extras/models/configs.py (+4 -2)
📝 netbox/extras/models/customfields.py (+3 -1)
📝 netbox/extras/models/models.py (+10 -5)
📝 netbox/extras/models/notifications.py (+2 -1)

...and 19 more files

📄 Description

Closes: #12318

  • Introduce two new database collations for und-u-ks-level2 (case-insensitive) and und-u-kn-true-ks-level2 (case-insensitive natural sort)
  • Alter all model CharFields which are referenced for uniqueness to use a case-insensitive collation in the PostgreSQL database
  • Remove all varchar_pattern_ops indexes attached to these fields (not supported with non-deterministic collations)
  • Alter the UniqueConstraints on the Device and VirtualMachine models to reference the name field without calling Lower()

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20681 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 10/24/2025 **Status:** ❌ Closed **Base:** `feature` ← **Head:** `12318-case-insensitive-uniqueness` --- ### 📝 Commits (4) - [`dac0a06`](https://github.com/netbox-community/netbox/commit/dac0a06f4fa72441adbb9645d81bee6e96af2494) Introduce case-insensitive collations - [`06052f8`](https://github.com/netbox-community/netbox/commit/06052f8eaa57a277020f8dc0e8a45a5435c3985e) Use case-insensitive collations on fields considered for uniqueness - [`a345533`](https://github.com/netbox-community/netbox/commit/a34553325e3cc5df2b4f49a29064a80f2cc2bd5d) Add migrations to remove indexes and alter field collations - [`4f2f61c`](https://github.com/netbox-community/netbox/commit/4f2f61c90db8f8fa90a984efa3590567965854cd) Reindex migrations ### 📊 Changes **39 files changed** (+1083 additions, -81 deletions) <details> <summary>View changed files</summary> ➕ `netbox/circuits/migrations/0053_ci_collations.py` (+97 -0) 📝 `netbox/circuits/models/circuits.py` (+3 -2) 📝 `netbox/circuits/models/providers.py` (+8 -5) 📝 `netbox/circuits/models/virtual_circuits.py` (+3 -2) ➕ `netbox/core/migrations/0020_ci_collations.py` (+30 -0) 📝 `netbox/core/models/data.py` (+2 -1) ➕ `netbox/dcim/migrations/0217_ci_collations.py` (+26 -0) ➕ `netbox/dcim/migrations/0218_ci_collations.py` (+311 -0) 📝 `netbox/dcim/models/device_component_templates.py` (+1 -1) 📝 `netbox/dcim/models/device_components.py` (+1 -1) 📝 `netbox/dcim/models/devices.py` (+11 -12) 📝 `netbox/dcim/models/modules.py` (+4 -2) 📝 `netbox/dcim/models/power.py` (+2 -2) 📝 `netbox/dcim/models/racks.py` (+5 -3) 📝 `netbox/dcim/models/sites.py` (+4 -3) ➕ `netbox/extras/migrations/0134_ci_collations.py` (+114 -0) 📝 `netbox/extras/models/configs.py` (+4 -2) 📝 `netbox/extras/models/customfields.py` (+3 -1) 📝 `netbox/extras/models/models.py` (+10 -5) 📝 `netbox/extras/models/notifications.py` (+2 -1) _...and 19 more files_ </details> ### 📄 Description ### Closes: #12318 - Introduce two new database collations for `und-u-ks-level2` (case-insensitive) and `und-u-kn-true-ks-level2` (case-insensitive natural sort) - Alter all model CharFields which are referenced for uniqueness to use a case-insensitive collation in the PostgreSQL database - Remove all `varchar_pattern_ops` indexes attached to these fields (not supported with non-deterministic collations) - Alter the UniqueConstraints on the Device and VirtualMachine models to reference the `name` field without calling `Lower()` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:17 +01:00
adam closed this issue 2025-12-30 00:25:17 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16008