mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
Fixes #8656: Fix migration error when upgrading from a v2.11 database
This commit is contained in:
parent
eb02f6137e
commit
39b8eb0ae0
@ -147,6 +147,7 @@ Where it is desired to limit the range of available VLANs within a group, users
|
|||||||
### Bug Fixes (From Beta)
|
### Bug Fixes (From Beta)
|
||||||
|
|
||||||
* [#8655](https://github.com/netbox-community/netbox/issues/8655) - Fix AttributeError when viewing cabled interfaces
|
* [#8655](https://github.com/netbox-community/netbox/issues/8655) - Fix AttributeError when viewing cabled interfaces
|
||||||
|
* [#8656](https://github.com/netbox-community/netbox/issues/8656) - Fix migration error when upgrading from a v2.11 database
|
||||||
* [#8659](https://github.com/netbox-community/netbox/issues/8659) - Fix display of multi-object custom fields after deleting related object
|
* [#8659](https://github.com/netbox-community/netbox/issues/8659) - Fix display of multi-object custom fields after deleting related object
|
||||||
* [#8661](https://github.com/netbox-community/netbox/issues/8661) - Fix ValueError exception when trying to connect a cable
|
* [#8661](https://github.com/netbox-community/netbox/issues/8661) - Fix ValueError exception when trying to connect a cable
|
||||||
* [#8670](https://github.com/netbox-community/netbox/issues/8670) - Fix filtering device components by installed module
|
* [#8670](https://github.com/netbox-community/netbox/issues/8670) - Fix filtering device components by installed module
|
||||||
|
@ -14,6 +14,31 @@ class Migration(migrations.Migration):
|
|||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
# Rename any indexes left over from the old Module model (now InventoryItem) (#8656)
|
||||||
|
migrations.RunSQL(
|
||||||
|
"""
|
||||||
|
DO $$
|
||||||
|
DECLARE
|
||||||
|
idx record;
|
||||||
|
BEGIN
|
||||||
|
FOR idx IN
|
||||||
|
SELECT indexname AS old_name,
|
||||||
|
replace(indexname, 'module', 'inventoryitem') AS new_name
|
||||||
|
FROM pg_indexes
|
||||||
|
WHERE schemaname = 'public' AND
|
||||||
|
tablename = 'dcim_inventoryitem' AND
|
||||||
|
indexname LIKE 'dcim_module_%'
|
||||||
|
LOOP
|
||||||
|
EXECUTE format(
|
||||||
|
'ALTER INDEX %I RENAME TO %I;',
|
||||||
|
idx.old_name,
|
||||||
|
idx.new_name
|
||||||
|
);
|
||||||
|
END LOOP;
|
||||||
|
END$$;
|
||||||
|
"""
|
||||||
|
),
|
||||||
|
|
||||||
migrations.AlterModelOptions(
|
migrations.AlterModelOptions(
|
||||||
name='consoleporttemplate',
|
name='consoleporttemplate',
|
||||||
options={'ordering': ('device_type', 'module_type', '_name')},
|
options={'ordering': ('device_type', 'module_type', '_name')},
|
||||||
|
Loading…
Reference in New Issue
Block a user