I have a 1.6.0 netbox that is in use in production that I need to upgrade to get all the features we need for a development pipeline.
In trying to upgrade in-place I ran into many issues. So I built a new box running 2.5.12 and am trying to migrate the database over.
I was able to pg_dump and load the database cleanly. However, when running the manage.py migrate command, I get the below output
#############
Migrate output
#############
*netbox]$ python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, circuits, contenttypes, dcim, extras, ipam, secrets, sessions, taggit, tenancy, users, virtualization
Running migrations:
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying tenancy.0003_unicode_literals... OK
Applying ipam.0008_prefix_change_order... OK
Applying ipam.0009_ipaddress_add_status... OK
Applying ipam.0010_ipaddress_help_texts... OK
Applying ipam.0011_rir_add_is_private... OK
Applying ipam.0012_services... OK
Applying ipam.0013_prefix_add_is_pool... OK
Applying ipam.0014_ipaddress_status_add_deprecated... OK
Applying ipam.0015_global_vlans... OK
Applying ipam.0016_unicode_literals... OK
Applying ipam.0017_ipaddress_roles... OK
Applying ipam.0018_remove_service_uniqueness_constraint... OK
Applying dcim.0023_devicetype_comments_squashed_0043_device_component_name_lengths... OK
Applying virtualization.0001_virtualization... OK
Applying ipam.0019_virtualization_squashed_0020_ipaddress_add_role_carp... OK
Applying dcim.0044_virtualization_squashed_0055_virtualchassis_ordering... OK
Applying dcim.0056_django2... OK
Applying dcim.0057_tags... OK
Applying dcim.0058_relax_rack_naming_constraints... OK
Applying dcim.0059_site_latitude_longitude... OK
Applying dcim.0060_change_logging... OK
Applying dcim.0061_platform_napalm_args... OK
Applying dcim.0062_interface_mtu... OK
Applying dcim.0063_device_local_context_data... OK
Applying dcim.0064_remove_platform_rpc_client... OK
Applying dcim.0065_front_rear_ports... OK
Applying circuits.0006_terminations...Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
psycopg2.DataError: value too long for type character varying(1)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 234, in handle
fake_initial=fake_initial,
File "/usr/local/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 "/usr/local/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 "/usr/local/lib/python3.6/site-packages/django/db/migrations/executor.py", line 245, in apply_migration
state = migration.apply(state, schema_editor)
File "/usr/local/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 "/usr/local/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.5.12/netbox/circuits/migrations/0006_terminations.py", line 19, in circuits_to_terms
pp_info=c.pp_info,
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 741, in save
force_update=force_update, update_fields=update_fields)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 779, in save_base
force_update, using, update_fields,
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 870, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/usr/local/lib/python3.6/site-packages/django/db/models/base.py", line 908, in _do_insert
using=using, raw=raw)
File "/usr/local/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/db/models/query.py", line 1186, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1335, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.6/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/usr/local/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
django.db.utils.DataError: value too long for type character varying(1)
In looking closer at this, it seems that the migration script might be looking for a value that doesnt actually exist because the feature had not been added.
I'm thinking I might have to run several versions of the migration script to bring this database up to this generation.
Does anyone have any thoughts or knowledge on which versions I would have to go through?