prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Modify page routing to allow for any database name
  ## Current behavior
  
  - Many of our pages have URLs that begin with the database name.
  - We also have routes that begin with things like `administration` and `auth`.
  - Those routing rules produce an ambiguous routing grammar making it impossible to use Mathesar with a database named "administration" (for example).
  
  ## Desired behavior
  
  We should change `/<db_name>/` to `/db/<db_name>`
  
  
  
  </issue>
  <code>
  [start of mathesar/urls.py]
  1 from django.contrib.auth.views import LoginView
  2 from django.urls import include, path, re_path
  3 from rest_framework_nested import routers
  4 
  5 from mathesar import views
  6 from mathesar.api.db import viewsets as db_viewsets
  7 from mathesar.api.ui import viewsets as ui_viewsets
  8 from mathesar.users.password_reset import MathesarPasswordResetConfirmView
  9 
  10 db_router = routers.DefaultRouter()
  11 db_router.register(r'tables', db_viewsets.TableViewSet, basename='table')
  12 db_router.register(r'queries', db_viewsets.QueryViewSet, basename='query')
  13 db_router.register(r'links', db_viewsets.LinkViewSet, basename='links')
  14 db_router.register(r'schemas', db_viewsets.SchemaViewSet, basename='schema')
  15 db_router.register(r'databases', db_viewsets.DatabaseViewSet, basename='database')
  16 db_router.register(r'data_files', db_viewsets.DataFileViewSet, basename='data-file')
  17 
  18 db_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')
  19 db_table_router.register(r'records', db_viewsets.RecordViewSet, basename='table-record')
  20 db_table_router.register(r'settings', db_viewsets.TableSettingsViewSet, basename='table-setting')
  21 db_table_router.register(r'columns', db_viewsets.ColumnViewSet, basename='table-column')
  22 db_table_router.register(r'constraints', db_viewsets.ConstraintViewSet, basename='table-constraint')
  23 
  24 ui_router = routers.DefaultRouter()
  25 ui_router.register(r'version', ui_viewsets.VersionViewSet, basename='version')
  26 ui_router.register(r'databases', ui_viewsets.DatabaseViewSet, basename='database')
  27 ui_router.register(r'users', ui_viewsets.UserViewSet, basename='user')
  28 ui_router.register(r'database_roles', ui_viewsets.DatabaseRoleViewSet, basename='database_role')
  29 ui_router.register(r'schema_roles', ui_viewsets.SchemaRoleViewSet, basename='schema_role')
  30 
  31 ui_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')
  32 ui_table_router.register(r'records', ui_viewsets.RecordViewSet, basename='table-record')
  33 
  34 urlpatterns = [
  35     path('api/db/v0/', include(db_router.urls)),
  36     path('api/db/v0/', include(db_table_router.urls)),
  37     path('api/ui/v0/', include(ui_router.urls)),
  38     path('api/ui/v0/', include(ui_table_router.urls)),
  39     path('api/ui/v0/reflect/', views.reflect_all, name='reflect_all'),
  40     path('auth/password_reset_confirm', MathesarPasswordResetConfirmView.as_view(), name='password_reset_confirm'),
  41     path('auth/login/', LoginView.as_view(redirect_authenticated_user=True), name='login'),
  42     path('auth/', include('django.contrib.auth.urls')),
  43     path('', views.home, name='home'),
  44     path('profile/', views.profile, name='profile'),
  45     path('administration/', views.admin_home, name='admin_home'),
  46     path('administration/users/', views.admin_home, name='admin_users_home'),
  47     path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),
  48     path('administration/update/', views.admin_home, name='admin_update'),
  49     path('<db_name>/', views.schemas, name='schemas'),
  50     re_path(
  51         r'^(?P<db_name>\w+)/(?P<schema_id>\w+)/',
  52         views.schema_home,
  53         name='schema_home'
  54     ),
  55 ]
  56
  [end of mathesar/urls.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/mathesar/urls.py b/mathesar/urls.py
  --- a/mathesar/urls.py
  +++ b/mathesar/urls.py
  @@ -46,9 +46,10 @@
       path('administration/users/', views.admin_home, name='admin_users_home'),
       path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),
       path('administration/update/', views.admin_home, name='admin_update'),
  -    path('<db_name>/', views.schemas, name='schemas'),
  +    path('db/', views.home, name='db_home'),
  +    path('db/<db_name>/', views.schemas, name='schemas'),
       re_path(
  -        r'^(?P<db_name>\w+)/(?P<schema_id>\w+)/',
  +        r'^db/(?P<db_name>\w+)/(?P<schema_id>\w+)/',
           views.schema_home,
           name='schema_home'
       ),
  
verification_info: {"golden_diff": "diff --git a/mathesar/urls.py b/mathesar/urls.py\n--- a/mathesar/urls.py\n+++ b/mathesar/urls.py\n@@ -46,9 +46,10 @@\n     path('administration/users/', views.admin_home, name='admin_users_home'),\n     path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),\n     path('administration/update/', views.admin_home, name='admin_update'),\n-    path('<db_name>/', views.schemas, name='schemas'),\n+    path('db/', views.home, name='db_home'),\n+    path('db/<db_name>/', views.schemas, name='schemas'),\n     re_path(\n-        r'^(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n+        r'^db/(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n         views.schema_home,\n         name='schema_home'\n     ),\n", "issue": "Modify page routing to allow for any database name\n## Current behavior\r\n\r\n- Many of our pages have URLs that begin with the database name.\r\n- We also have routes that begin with things like `administration` and `auth`.\r\n- Those routing rules produce an ambiguous routing grammar making it impossible to use Mathesar with a database named \"administration\" (for example).\r\n\r\n## Desired behavior\r\n\r\nWe should change `/<db_name>/` to `/db/<db_name>`\r\n\r\n\n", "before_files": [{"content": "from django.contrib.auth.views import LoginView\nfrom django.urls import include, path, re_path\nfrom rest_framework_nested import routers\n\nfrom mathesar import views\nfrom mathesar.api.db import viewsets as db_viewsets\nfrom mathesar.api.ui import viewsets as ui_viewsets\nfrom mathesar.users.password_reset import MathesarPasswordResetConfirmView\n\ndb_router = routers.DefaultRouter()\ndb_router.register(r'tables', db_viewsets.TableViewSet, basename='table')\ndb_router.register(r'queries', db_viewsets.QueryViewSet, basename='query')\ndb_router.register(r'links', db_viewsets.LinkViewSet, basename='links')\ndb_router.register(r'schemas', db_viewsets.SchemaViewSet, basename='schema')\ndb_router.register(r'databases', db_viewsets.DatabaseViewSet, basename='database')\ndb_router.register(r'data_files', db_viewsets.DataFileViewSet, basename='data-file')\n\ndb_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\ndb_table_router.register(r'records', db_viewsets.RecordViewSet, basename='table-record')\ndb_table_router.register(r'settings', db_viewsets.TableSettingsViewSet, basename='table-setting')\ndb_table_router.register(r'columns', db_viewsets.ColumnViewSet, basename='table-column')\ndb_table_router.register(r'constraints', db_viewsets.ConstraintViewSet, basename='table-constraint')\n\nui_router = routers.DefaultRouter()\nui_router.register(r'version', ui_viewsets.VersionViewSet, basename='version')\nui_router.register(r'databases', ui_viewsets.DatabaseViewSet, basename='database')\nui_router.register(r'users', ui_viewsets.UserViewSet, basename='user')\nui_router.register(r'database_roles', ui_viewsets.DatabaseRoleViewSet, basename='database_role')\nui_router.register(r'schema_roles', ui_viewsets.SchemaRoleViewSet, basename='schema_role')\n\nui_table_router = routers.NestedSimpleRouter(db_router, r'tables', lookup='table')\nui_table_router.register(r'records', ui_viewsets.RecordViewSet, basename='table-record')\n\nurlpatterns = [\n    path('api/db/v0/', include(db_router.urls)),\n    path('api/db/v0/', include(db_table_router.urls)),\n    path('api/ui/v0/', include(ui_router.urls)),\n    path('api/ui/v0/', include(ui_table_router.urls)),\n    path('api/ui/v0/reflect/', views.reflect_all, name='reflect_all'),\n    path('auth/password_reset_confirm', MathesarPasswordResetConfirmView.as_view(), name='password_reset_confirm'),\n    path('auth/login/', LoginView.as_view(redirect_authenticated_user=True), name='login'),\n    path('auth/', include('django.contrib.auth.urls')),\n    path('', views.home, name='home'),\n    path('profile/', views.profile, name='profile'),\n    path('administration/', views.admin_home, name='admin_home'),\n    path('administration/users/', views.admin_home, name='admin_users_home'),\n    path('administration/users/<user_id>/', views.admin_home, name='admin_users_edit'),\n    path('administration/update/', views.admin_home, name='admin_update'),\n    path('<db_name>/', views.schemas, name='schemas'),\n    re_path(\n        r'^(?P<db_name>\\w+)/(?P<schema_id>\\w+)/',\n        views.schema_home,\n        name='schema_home'\n    ),\n]\n", "path": "mathesar/urls.py"}]}