Replies: 2 comments 2 replies
-
Please run those commands, and report what you see when you run them. Also, what does
Yes, it will do - if the migrations didn't complete successfully then the database will be missing columns or entire tables that the Python code assumes are there. |
Beta Was this translation helpful? Give feedback.
-
Hi, thank you for your answer there is the output: (venv) [root@ntversion3 netbox]# python3 netbox/manage.py showmigrations SQL Version - |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey guys,
First I am gonna try to describe the steps done:
2 months back I have installed netbox v3.0.0 on the new Vm and run the full upgrade process as per official documentation https://docs.netbox.dev/en/stable/installation/upgrading/
This was sucessfull and I was able to restore the DB from our production netbox v2.11.12.
The new version v3.0.0 was accessible with the correct data. We didn't use the v3.0.0 ( we wanted to postpone ) and continued working with v2.11.12.
After 2 months I am trying to restore the current DB state again but I cannot access the new version now. Steps done:
Copy /reports, /scripts and /media to the new version v3.0.0
/opt/netbox/netbox/reports
/opt/netbox/netbox/scripts
/opt/netbox/netbox/media/
Drop and recreate new DB from the Prod backup
psql -c 'drop database netbox'
psql -c 'create database netbox'
psql netbox < netbox.sql
Run the ./upgrade.sh script PYTHON=/opt/python37/bin/python3 /opt/netbox/upgrade.sh
Error at the end of the upgrade.sh
Successfully built pyvmomi python-ldap
Installing collected packages: pyasn1, pyasn1-modules, lxml, dnspython, pyvmomi, python-ldap, django-auth-ldap
Successfully installed django-auth-ldap-4.1.0 dnspython-2.2.1 lxml-4.9.1 pyasn1-0.4.8 pyasn1-modules-0.2.8 python-ldap-3.4.3 pyvmomi-7.0.3
ERROR: Database schema migrations are out of synchronization. (No
data has been lost.) If attempting to upgrade to NetBox v3.0 or
later, first upgrade to a v2.11 release to ensure schema migrations
have been correctly prepared. For further detail on the exact error,
run the following commands:
After that when accessing netbox, it gives me the following error
Server Error
A database programming error was detected while processing this request. Common causes include the following:
Database migrations missing - When upgrading to a new NetBox release, the upgrade script must be run to apply any new database migrations. You can run migrations manually by executing python3 manage.py migrate from the command line.
Unsupported PostgreSQL version - Ensure that PostgreSQL version 9.6 or higher is in use. You can check this by connecting to the database using NetBox's credentials and issuing a query for SELECT VERSION().
The complete exception is provided below:
<class 'django.db.utils.ProgrammingError'>
column extras_customfield.created does not exist
LINE 1: SELECT "extras_customfield"."created", "extras_customfield"....
^
Python version: 3.7.11
NetBox version: 3.0.0
Postgres version: postgresql12
Redis version: redis-4.0.2-1.el7.x86_64
Thank you in advance for any suggestions how to solve this
Beta Was this translation helpful? Give feedback.
All reactions