Custom Fields Migration error 2.10.1
See original GitHub issueEnvironment
- Python version: 3.6.9
- NetBox version: migration from 2.9.4 to 2.10.1
Steps to Reproduce
- have some custom fields in 2.9.4
- ./upgrade.sh
Expected Behavior
Observed Behavior
Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
Running migrations:
Applying extras.0051_migrate_customfields...Traceback (most recent call last):
File "netbox/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 245, in handle
fake_initial=fake_initial,
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/opt/netbox-2.10.1/venv/lib/python3.6/site-packages/django/db/migrations/operations/special.py", line 190, in database_forwards
self.code(from_state.apps, schema_editor)
File "/opt/netbox-2.10.1/netbox/extras/migrations/0051_migrate_customfields.py", line 69, in migrate_customfieldvalues
cf_data['custom_field_data'][cfv.field.name] = deserialize_value(cfv.field, cfv.serialized_value)
TypeError: 'NoneType' object is not subscriptable
i insert some prints and cf_data is None from this DB Query:
SELECT "dcim_rack"."custom_field_data" FROM "dcim_rack" INNER JOIN "dcim_site" ON ("dcim_rack"."site_id" = "dcim_site"."id") LEFT OUTER JOIN "dcim_rackgroup" ON ("dcim_rack"."group_id" = "dcim_rackgroup"."id") LEFT OUTER JOIN "dcim_site" T4 ON ("dcim_rackgroup"."site_id" = T4."id") WHERE "dcim_rack"."id" = 1 ORDER BY "dcim_site"."_name" ASC, T4."_name" ASC, "dcim_rackgroup"."name" ASC, "dcim_rack"."_name" ASC, "dcim_rack"."id" ASC
this field produce the error.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
How to fix error upgrading Wagtail 2.10.2 to 2.11.8?
But I always get an error when running migrate: TypeError: Field 'id' expected a number but got... Followed by either.
Read more >Custom Fields migration error - Google Groups
On the 2.11. 12, the custom field were assigned to "DCIM > device". I have no customization implemented yet, apart from a custom...
Read more >Undefined index in custom field? - ExpressionEngine® Answers
Error is missing a field in database. When you create a new member field, It creates two fields in DB under exp_member_data table....
Read more >2.10. Documents migration — MongoEngine 0.24.2 ...
At first sight it looks like you don't need to migrate the existing documents when adding new fields but this actually leads to...
Read more >JCMA doesn't Migrate Supported Custom Fields
When we are running a Jira migration through JCMA, we may find that some Custom Fields are not migrating even though they are...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, this is a very old installation back to 2.2 or 2.3 maybe there some artifacts in the DB. i used your code snippet in the 0051_migrate_customfields.py file and the migration run without an error. At the moment i don’t see any issues with this custom field after the migration.
Thanks @jeremystretch I found the script issue, fixed my version and reported it here https://github.com/netbox-community/netbox-docker/issues/373 in case anyone else lands here thinking it’s the same issue.