Migration "Applying users.0008_flip_objectpermission_assignments" to 4.0-beta1 fails #9483

Closed
opened 2025-12-29 20:50:32 +01:00 by adam · 3 comments
Owner

Originally created by @tobiasge on GitHub (Apr 16, 2024).

Deployment Type

Self-hosted

NetBox Version

v4.0-beta1 (4e4c277711)

Python Version

3.11

Steps to Reproduce

  1. Netbox setup with 3.7.5 (upgraded from 2.5)
  2. Migrate to v4.0-beta1 (4e4c277711)

Expected Behavior

Successful run of all migrations

Observed Behavior

Migration Applying users.0008_flip_objectpermission_assignments fails with this error:

psycopg.errors.UndefinedObject: constraint "users_objectpermissi_objectpermission_id_2f7cc117_fk_users_obj" for table "users_group_object_permissions" does not exist
Originally created by @tobiasge on GitHub (Apr 16, 2024). ### Deployment Type Self-hosted ### NetBox Version v4.0-beta1 (4e4c2777113595273275255486a27c2246a7aec6) ### Python Version 3.11 ### Steps to Reproduce 1. Netbox setup with 3.7.5 (upgraded from 2.5) 2. Migrate to v4.0-beta1 (4e4c2777113595273275255486a27c2246a7aec6) ### Expected Behavior Successful run of all migrations ### Observed Behavior Migration `Applying users.0008_flip_objectpermission_assignments` fails with this error: ``` psycopg.errors.UndefinedObject: constraint "users_objectpermissi_objectpermission_id_2f7cc117_fk_users_obj" for table "users_group_object_permissions" does not exist ```
adam added the type: bugstatus: duplicate labels 2025-12-29 20:50:32 +01:00
adam closed this issue 2025-12-29 20:50:32 +01:00
Author
Owner

@tobiasge commented on GitHub (Apr 16, 2024):

The table users_objectpermission_groups is renamed to users_group_object_permissions. The original table in our database looks like this:

netbox-local-test=> \d users_objectpermission_groups
                                   Table "public.users_objectpermission_groups"
       Column        |  Type   | Collation | Nullable |                          Default
---------------------+---------+-----------+----------+-----------------------------------------------------------
 id                  | integer |           | not null | nextval('users_objectpermission_groups_id_seq'::regclass)
 objectpermission_id | bigint  |           | not null |
 group_id            | integer |           | not null |
Indexes:
    "users_objectpermission_groups_pkey" PRIMARY KEY, btree (id)
    "users_objectpermission_g_objectpermission_id_grou_3b62a39c_uniq" UNIQUE CONSTRAINT, btree (objectpermission_id, group_id)
    "users_objectpermission_groups_group_id_fb7ba6e0" btree (group_id)
    "users_objectpermission_groups_objectpermission_id_2f7cc117" btree (objectpermission_id)
Foreign-key constraints:
    "users_objectpermissi_group_id_fb7ba6e0_fk_auth_grou" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED
@tobiasge commented on GitHub (Apr 16, 2024): The table `users_objectpermission_groups` is renamed to `users_group_object_permissions`. The original table in our database looks like this: ``` netbox-local-test=> \d users_objectpermission_groups Table "public.users_objectpermission_groups" Column | Type | Collation | Nullable | Default ---------------------+---------+-----------+----------+----------------------------------------------------------- id | integer | | not null | nextval('users_objectpermission_groups_id_seq'::regclass) objectpermission_id | bigint | | not null | group_id | integer | | not null | Indexes: "users_objectpermission_groups_pkey" PRIMARY KEY, btree (id) "users_objectpermission_g_objectpermission_id_grou_3b62a39c_uniq" UNIQUE CONSTRAINT, btree (objectpermission_id, group_id) "users_objectpermission_groups_group_id_fb7ba6e0" btree (group_id) "users_objectpermission_groups_objectpermission_id_2f7cc117" btree (objectpermission_id) Foreign-key constraints: "users_objectpermissi_group_id_fb7ba6e0_fk_auth_grou" FOREIGN KEY (group_id) REFERENCES auth_group(id) DEFERRABLE INITIALLY DEFERRED ```
Author
Owner

@a084ed22 commented on GitHub (Apr 16, 2024):

This is likely my same problem (#15698)

@a084ed22 commented on GitHub (Apr 16, 2024): This is likely my same problem (#15698)
Author
Owner

@tobiasge commented on GitHub (Apr 16, 2024):

Looks like it from the stack trace. Sorry for the duplicated report.

@tobiasge commented on GitHub (Apr 16, 2024): Looks like it from the stack trace. Sorry for the duplicated report.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9483