-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ProgrammingError exception when upgrading to v4.0 #15605
Comments
You cannot upgrade from v3.6 directly to v4.0: Per the documentation you'll need to first upgrade to v3.7 to ensure all migrations are applied prior to being squashed.
However, it should work fine when upgrading from v3.7.x. On a clean install of NetBox v3.7.4 (starting with an empty database), I have
And after switching to the v4.0-beta code base, all migrations apply successfully:
With your original v3.7.4 database in place, do you see |
With this:
I get the following:
|
You're missing at least one required library, which indicates that the installation/upgrade instructions were not followed. Please go back and ensure that your v3.7 deployment is fully functional before attempting to upgrade to v4.0. |
Thanks, I beleive I now installed all django packages.
Here are all the tables (347 rows):
|
You should not have to install anything. You should allow Netbox to create a virtualenv and populate it; this is all done using the If you find you have to install packages manually then there is definitely some other problem: you need to stop and fix that problem, before continuing. EDIT: if you did this (as you say):
and you got that error, it means you probably hadn't activated the virtualenv before running the command. You definitely should not install django packages globally to workaround that issue. Actually, there's a safer way to run it:
This will activate the virtualenv for you (regardless of whether it's currently activated or not) |
Yes, after I run this command, I can immediately list all tables with "\d" command, as Jeremy asked.
I can run upgrade.sh without problems:
Even after successful execution of this script on the stable version 3.7.4, I am not able to upgrade to beta. I mean, first I do this: And really, when one looks at the tables I posted above, there is a missing row with sequence regarding the custom field content type. |
I have this problem too.
Trying to force migration to extras on version 3.7.4 reports no changes: /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py migrate extras
Operations to perform:
Apply all migrations: extras
Running migrations:
No migrations to apply. So I have the same error when trying to update to v4.0-beta1. |
It's broken for me too; some of the sequences and indexes in my system (and your system, and some others it seems) have different names to the ones that the migration scripts are expecting, and some constraints are missing. I was able to make the migrations complete with some temporary patches: But there's some underlying issue about how machines which have a long history of upgrades having different constraint names than those currently expected. |
Regarding the long history of upgrades, which other users have also discussed, it might be worth mentioning that we initially had version 2.8, then progressed subsequently to 2.11, followed by 3.0, and subsequently to each minor version (3.1, 3.2, etc.). At one moment we did clean install of 3.x (don't remember the particular version) and did migrate all data from the same version from another server. |
This comment was marked as off-topic.
This comment was marked as off-topic.
To add to the data set, I had the same issues as documented in #15601 (reply in thread). The VM I installed onto is a brand new ubuntu 22.04 machine with a fresh install of 3.7.4, but the database that was imported was upgraded over the years from 1.9.5, or at least, that's the first version I know we had on our production box. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
After fixing this by manually creating the mentioned files I am also running into the |
I've hidden several comments in the thread which are not relevant to the reported behavior above. Please remember to open a separate bug report for unrelated issues. |
Could someone who is experiencing this issue please post the list of tables which exist in their database prior to attempting the upgrade to v4.0? This can be done by running I'm specifically interested in determining how |
I have a setup from the 2.11 era, gradually updated, currently on 3.7.5. I don't have a sequence for extras_customfield_content_types_id_seq. |
This is the list from our Netbox 3.7.5 (first installation on this DB was from 2.5 or 2.4):
I think it's named
|
Yep, that seems to be the issue. This was from the old We can tweak the v4.0 migration to check for either sequence name and rename it accordingly. |
@opericgithub @a084ed22 @tobiasge (and anyone else experiencing this issue), could you try checking out the |
The content types are now working for out database.
But now I'm seeing a new error:
|
I can confirm that the fix allows the specific migration to work, however I'm later stuck on this:
|
Sure. I tried checking out to that branch, upgrade completes without errors, but I stay on the same version (3.7.5).
|
I'm going to merge PR #15661 and consider this fixed as the above feedback indicates that the If you continue to experience different errors when attempting to upgrade, please submit a new bug report with details. @opericgithub Try just running the migration command ( |
Deployment Type
Self-hosted
NetBox Version
v3.7.4 and v3.6.9
Python Version
3.10
Steps to Reproduce
I'm not sure whether this is the right place, but please correct me if I should post this issue in some other place.
I tried to do the upgrade from v3.7.4 as well as from v3.6.9, to the new v4.0.x (x = either feature, or beta).
First I tried upgrading to feature branch few days ago, and now I tried upgrading to v4.0-beta1.
I was using the following commands:
Then I get the following error messages:
Am I doing something wrong? Is there anything else I should check for?
I am also afraid that I won't be able to do the upgrade to the final version v4.0 in few weeks.
Expected Behavior
I expect to upgrade to the new (beta) version, as I was able to do this in the past using the same commands.
Observed Behavior
I get the error:
django.db.utils.ProgrammingError: relation "extras_customfield_content_types_id_seq" does not exist
Detailed log messages are given above.
The text was updated successfully, but these errors were encountered: