prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  New User model has a 32-bit integer `id` field
  ### Deployment Type
  
  NetBox Cloud
  
  ### NetBox Version
  
  v4.0-beta1
  
  ### Python Version
  
  3.10
  
  ### Steps to Reproduce
  
  1. Upgrade a v3.7 database to v4.0
  2. Inspect the `users_user` table
  
  ### Expected Behavior
  
  The `id` column of the `users_user` table should be a `bigint` (64-bit integer), like all other models in NetBox.
  
  ### Observed Behavior
  
  The `id` column is a regular 32-bit integer. This is because we renamed the stock Django table, which uses a 32-bit integer `id` field.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `netbox/users/migrations/0005_alter_user_table.py`
  Content:
  ```
  1 from django.db import migrations
  2 
  3 
  4 def update_content_types(apps, schema_editor):
  5     ContentType = apps.get_model('contenttypes', 'ContentType')
  6     # Delete the new ContentTypes effected by the new models in the users app
  7     ContentType.objects.filter(app_label='users', model='user').delete()
  8 
  9     # Update the app labels of the original ContentTypes for auth.User to ensure
  10     # that any foreign key references are preserved
  11     ContentType.objects.filter(app_label='auth', model='user').update(app_label='users')
  12 
  13     netboxuser_ct = ContentType.objects.filter(app_label='users', model='netboxuser').first()
  14     if netboxuser_ct:
  15         user_ct = ContentType.objects.filter(app_label='users', model='user').first()
  16         CustomField = apps.get_model('extras', 'CustomField')
  17         CustomField.objects.filter(related_object_type_id=netboxuser_ct.id).update(related_object_type_id=user_ct.id)
  18         netboxuser_ct.delete()
  19 
  20 
  21 class Migration(migrations.Migration):
  22 
  23     dependencies = [
  24         ('users', '0002_squashed_0004'),
  25     ]
  26 
  27     operations = [
  28         # The User table was originally created as 'auth_user'. Now we nullify the model's
  29         # db_table option, so that it defaults to the app & model name (users_user). This
  30         # causes the database table to be renamed.
  31         migrations.AlterModelTable(
  32             name='user',
  33             table=None,
  34         ),
  35 
  36         # Rename auth_user_* sequences
  37         migrations.RunSQL("ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq"),
  38         migrations.RunSQL("ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq"),
  39         migrations.RunSQL("ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq"),
  40 
  41         # Rename auth_user_* indexes
  42         migrations.RunSQL("ALTER INDEX auth_user_pkey RENAME TO users_user_pkey"),
  43         # Hash is deterministic; generated via schema_editor._create_index_name()
  44         migrations.RunSQL("ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like"),
  45         migrations.RunSQL("ALTER INDEX auth_user_username_key RENAME TO users_user_username_key"),
  46 
  47         # Update ContentTypes
  48         migrations.RunPython(
  49             code=update_content_types,
  50             reverse_code=migrations.RunPython.noop
  51         ),
  52     ]
  53
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/netbox/users/migrations/0005_alter_user_table.py b/netbox/users/migrations/0005_alter_user_table.py
  --- a/netbox/users/migrations/0005_alter_user_table.py
  +++ b/netbox/users/migrations/0005_alter_user_table.py
  @@ -33,6 +33,9 @@
               table=None,
           ),
   
  +        # Convert the `id` column to a 64-bit integer (BigAutoField is implied by DEFAULT_AUTO_FIELD)
  +        migrations.RunSQL("ALTER TABLE users_user ALTER COLUMN id TYPE bigint"),
  +
           # Rename auth_user_* sequences
           migrations.RunSQL("ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq"),
           migrations.RunSQL("ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq"),
  
verification_info: {"golden_diff": "diff --git a/netbox/users/migrations/0005_alter_user_table.py b/netbox/users/migrations/0005_alter_user_table.py\n--- a/netbox/users/migrations/0005_alter_user_table.py\n+++ b/netbox/users/migrations/0005_alter_user_table.py\n@@ -33,6 +33,9 @@\n             table=None,\n         ),\n \n+        # Convert the `id` column to a 64-bit integer (BigAutoField is implied by DEFAULT_AUTO_FIELD)\n+        migrations.RunSQL(\"ALTER TABLE users_user ALTER COLUMN id TYPE bigint\"),\n+\n         # Rename auth_user_* sequences\n         migrations.RunSQL(\"ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq\"),\n         migrations.RunSQL(\"ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq\"),\n", "issue": "New User model has a 32-bit integer `id` field\n### Deployment Type\n\nNetBox Cloud\n\n### NetBox Version\n\nv4.0-beta1\n\n### Python Version\n\n3.10\n\n### Steps to Reproduce\n\n1. Upgrade a v3.7 database to v4.0\r\n2. Inspect the `users_user` table\n\n### Expected Behavior\n\nThe `id` column of the `users_user` table should be a `bigint` (64-bit integer), like all other models in NetBox.\n\n### Observed Behavior\n\nThe `id` column is a regular 32-bit integer. This is because we renamed the stock Django table, which uses a 32-bit integer `id` field.\n", "before_files": [{"content": "from django.db import migrations\n\n\ndef update_content_types(apps, schema_editor):\n    ContentType = apps.get_model('contenttypes', 'ContentType')\n    # Delete the new ContentTypes effected by the new models in the users app\n    ContentType.objects.filter(app_label='users', model='user').delete()\n\n    # Update the app labels of the original ContentTypes for auth.User to ensure\n    # that any foreign key references are preserved\n    ContentType.objects.filter(app_label='auth', model='user').update(app_label='users')\n\n    netboxuser_ct = ContentType.objects.filter(app_label='users', model='netboxuser').first()\n    if netboxuser_ct:\n        user_ct = ContentType.objects.filter(app_label='users', model='user').first()\n        CustomField = apps.get_model('extras', 'CustomField')\n        CustomField.objects.filter(related_object_type_id=netboxuser_ct.id).update(related_object_type_id=user_ct.id)\n        netboxuser_ct.delete()\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('users', '0002_squashed_0004'),\n    ]\n\n    operations = [\n        # The User table was originally created as 'auth_user'. Now we nullify the model's\n        # db_table option, so that it defaults to the app & model name (users_user). This\n        # causes the database table to be renamed.\n        migrations.AlterModelTable(\n            name='user',\n            table=None,\n        ),\n\n        # Rename auth_user_* sequences\n        migrations.RunSQL(\"ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq\"),\n        migrations.RunSQL(\"ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq\"),\n        migrations.RunSQL(\"ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq\"),\n\n        # Rename auth_user_* indexes\n        migrations.RunSQL(\"ALTER INDEX auth_user_pkey RENAME TO users_user_pkey\"),\n        # Hash is deterministic; generated via schema_editor._create_index_name()\n        migrations.RunSQL(\"ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like\"),\n        migrations.RunSQL(\"ALTER INDEX auth_user_username_key RENAME TO users_user_username_key\"),\n\n        # Update ContentTypes\n        migrations.RunPython(\n            code=update_content_types,\n            reverse_code=migrations.RunPython.noop\n        ),\n    ]\n", "path": "netbox/users/migrations/0005_alter_user_table.py"}], "after_files": [{"content": "from django.db import migrations\n\n\ndef update_content_types(apps, schema_editor):\n    ContentType = apps.get_model('contenttypes', 'ContentType')\n    # Delete the new ContentTypes effected by the new models in the users app\n    ContentType.objects.filter(app_label='users', model='user').delete()\n\n    # Update the app labels of the original ContentTypes for auth.User to ensure\n    # that any foreign key references are preserved\n    ContentType.objects.filter(app_label='auth', model='user').update(app_label='users')\n\n    netboxuser_ct = ContentType.objects.filter(app_label='users', model='netboxuser').first()\n    if netboxuser_ct:\n        user_ct = ContentType.objects.filter(app_label='users', model='user').first()\n        CustomField = apps.get_model('extras', 'CustomField')\n        CustomField.objects.filter(related_object_type_id=netboxuser_ct.id).update(related_object_type_id=user_ct.id)\n        netboxuser_ct.delete()\n\n\nclass Migration(migrations.Migration):\n\n    dependencies = [\n        ('users', '0002_squashed_0004'),\n    ]\n\n    operations = [\n        # The User table was originally created as 'auth_user'. Now we nullify the model's\n        # db_table option, so that it defaults to the app & model name (users_user). This\n        # causes the database table to be renamed.\n        migrations.AlterModelTable(\n            name='user',\n            table=None,\n        ),\n\n        # Convert the `id` column to a 64-bit integer (BigAutoField is implied by DEFAULT_AUTO_FIELD)\n        migrations.RunSQL(\"ALTER TABLE users_user ALTER COLUMN id TYPE bigint\"),\n\n        # Rename auth_user_* sequences\n        migrations.RunSQL(\"ALTER TABLE auth_user_groups_id_seq RENAME TO users_user_groups_id_seq\"),\n        migrations.RunSQL(\"ALTER TABLE auth_user_id_seq RENAME TO users_user_id_seq\"),\n        migrations.RunSQL(\"ALTER TABLE auth_user_user_permissions_id_seq RENAME TO users_user_user_permissions_id_seq\"),\n\n        # Rename auth_user_* indexes\n        migrations.RunSQL(\"ALTER INDEX auth_user_pkey RENAME TO users_user_pkey\"),\n        # Hash is deterministic; generated via schema_editor._create_index_name()\n        migrations.RunSQL(\"ALTER INDEX auth_user_username_6821ab7c_like RENAME TO users_user_username_06e46fe6_like\"),\n        migrations.RunSQL(\"ALTER INDEX auth_user_username_key RENAME TO users_user_username_key\"),\n\n        # Update ContentTypes\n        migrations.RunPython(\n            code=update_content_types,\n            reverse_code=migrations.RunPython.noop\n        ),\n    ]\n", "path": "netbox/users/migrations/0005_alter_user_table.py"}]}