prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Implement showing and changing a column's type
  ## Problem
  <!-- Please provide a clear and concise description of the problem that this feature request is designed to solve.-->
  Users might want to change the data type of an existing column on their table.
  
  ## Proposed solution
  <!-- A clear and concise description of your proposed solution or feature. -->
  The ["Working with Columns" design spec](https://wiki.mathesar.org/en/design/specs/working-with-columns) has a solution for showing and changing column types, which we need to implement on the frontend.
  
  Please note that we're only implementing changing the Mathesar data type in this milestone. Options specific to individual data types will be implemented in the next milestone.
  
  Number data types should save as `NUMERIC`.
  Text data types should save as `VARCHAR`.
  Date/time data types can be disabled for now since they're not fully implemented on the backend.
  
  ## Additional context
  <!-- Add any other context or screenshots about the feature request here.-->
  - Backend work:
    - #532 to get the list of types 
    - #199 to get valid target types and change types 
  - Design issue: #324 
  - Design discussion: #436
  - #269 
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mathesar/views.py`
  Content:
  ```
  1 from django.shortcuts import render, redirect, get_object_or_404
  2 
  3 from mathesar.models import Database, Schema, Table
  4 from mathesar.api.serializers.databases import DatabaseSerializer
  5 from mathesar.api.serializers.schemas import SchemaSerializer
  6 from mathesar.api.serializers.tables import TableSerializer
  7 
  8 
  9 def get_schema_list(request, database):
  10     schema_serializer = SchemaSerializer(
  11         Schema.objects.filter(database=database),
  12         many=True,
  13         context={'request': request}
  14     )
  15     return schema_serializer.data
  16 
  17 
  18 def get_database_list(request):
  19     database_serializer = DatabaseSerializer(
  20         Database.objects.all(),
  21         many=True,
  22         context={'request': request}
  23     )
  24     return database_serializer.data
  25 
  26 
  27 def get_table_list(request, schema):
  28     if schema is None:
  29         return []
  30     table_serializer = TableSerializer(
  31         Table.objects.filter(schema=schema),
  32         many=True,
  33         context={'request': request}
  34     )
  35     return table_serializer.data
  36 
  37 
  38 def get_common_data(request, database, schema=None):
  39     return {
  40         'current_db': database.name if database else None,
  41         'current_schema': schema.id if schema else None,
  42         'schemas': get_schema_list(request, database),
  43         'databases': get_database_list(request),
  44         'tables': get_table_list(request, schema)
  45     }
  46 
  47 
  48 def get_current_database(request, db_name):
  49     # if there's a DB name passed in, try to retrieve the database, or return a 404 error.
  50     if db_name is not None:
  51         return get_object_or_404(Database, name=db_name)
  52     else:
  53         try:
  54             # Try to get the first database available
  55             return Database.objects.order_by('id').first()
  56         except Database.DoesNotExist:
  57             return None
  58 
  59 
  60 def get_current_schema(request, schema_id, database):
  61     # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.
  62     if schema_id is not None:
  63         return get_object_or_404(Schema, id=schema_id)
  64     else:
  65         try:
  66             # Try to get the first schema in the DB
  67             return Schema.objects.filter(database=database).order_by('id').first()
  68         except Schema.DoesNotExist:
  69             return None
  70 
  71 
  72 def render_schema(request, database, schema):
  73     # if there's no schema available, redirect to the schemas page.
  74     if not schema:
  75         return redirect('schemas', db_name=database.name)
  76     else:
  77         # We are redirecting so that the correct URL is passed to the frontend.
  78         return redirect('schema_home', db_name=database.name, schema_id=schema.id)
  79 
  80 
  81 def home(request):
  82     database = get_current_database(request, None)
  83     schema = get_current_schema(request, None, database)
  84     return render_schema(request, database, schema)
  85 
  86 
  87 def db_home(request, db_name):
  88     database = get_current_database(request, db_name)
  89     schema = get_current_schema(request, None, database)
  90     return render_schema(request, database, schema)
  91 
  92 
  93 def schema_home(request, db_name, schema_id):
  94     database = get_current_database(request, db_name)
  95     schema = get_current_schema(request, schema_id, database)
  96     return render(request, 'mathesar/index.html', {
  97         'common_data': get_common_data(request, database, schema)
  98     })
  99 
  100 
  101 def schemas(request, db_name):
  102     database = get_current_database(request, db_name)
  103     schema = get_current_schema(request, None, database)
  104     return render(request, 'mathesar/index.html', {
  105         'common_data': get_common_data(request, database, schema)
  106     })
  107
  ```
  --- 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/mathesar/views.py b/mathesar/views.py
  --- a/mathesar/views.py
  +++ b/mathesar/views.py
  @@ -1,7 +1,7 @@
   from django.shortcuts import render, redirect, get_object_or_404
   
   from mathesar.models import Database, Schema, Table
  -from mathesar.api.serializers.databases import DatabaseSerializer
  +from mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer
   from mathesar.api.serializers.schemas import SchemaSerializer
   from mathesar.api.serializers.tables import TableSerializer
   
  @@ -35,13 +35,25 @@
       return table_serializer.data
   
   
  +def get_type_list(request, database):
  +    if database is None:
  +        return []
  +    type_serializer = TypeSerializer(
  +        database.supported_types,
  +        many=True,
  +        context={'request': request}
  +    )
  +    return type_serializer.data
  +
  +
   def get_common_data(request, database, schema=None):
       return {
           'current_db': database.name if database else None,
           'current_schema': schema.id if schema else None,
           'schemas': get_schema_list(request, database),
           'databases': get_database_list(request),
  -        'tables': get_table_list(request, schema)
  +        'tables': get_table_list(request, schema),
  +        'abstract_types': get_type_list(request, database)
       }
  
verification_info: {"golden_diff": "diff --git a/mathesar/views.py b/mathesar/views.py\n--- a/mathesar/views.py\n+++ b/mathesar/views.py\n@@ -1,7 +1,7 @@\n from django.shortcuts import render, redirect, get_object_or_404\n \n from mathesar.models import Database, Schema, Table\n-from mathesar.api.serializers.databases import DatabaseSerializer\n+from mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer\n from mathesar.api.serializers.schemas import SchemaSerializer\n from mathesar.api.serializers.tables import TableSerializer\n \n@@ -35,13 +35,25 @@\n     return table_serializer.data\n \n \n+def get_type_list(request, database):\n+    if database is None:\n+        return []\n+    type_serializer = TypeSerializer(\n+        database.supported_types,\n+        many=True,\n+        context={'request': request}\n+    )\n+    return type_serializer.data\n+\n+\n def get_common_data(request, database, schema=None):\n     return {\n         'current_db': database.name if database else None,\n         'current_schema': schema.id if schema else None,\n         'schemas': get_schema_list(request, database),\n         'databases': get_database_list(request),\n-        'tables': get_table_list(request, schema)\n+        'tables': get_table_list(request, schema),\n+        'abstract_types': get_type_list(request, database)\n     }\n", "issue": "Implement showing and changing a column's type\n## Problem\r\n<!-- Please provide a clear and concise description of the problem that this feature request is designed to solve.-->\r\nUsers might want to change the data type of an existing column on their table.\r\n\r\n## Proposed solution\r\n<!-- A clear and concise description of your proposed solution or feature. -->\r\nThe [\"Working with Columns\" design spec](https://wiki.mathesar.org/en/design/specs/working-with-columns) has a solution for showing and changing column types, which we need to implement on the frontend.\r\n\r\nPlease note that we're only implementing changing the Mathesar data type in this milestone. Options specific to individual data types will be implemented in the next milestone.\r\n\r\nNumber data types should save as `NUMERIC`.\r\nText data types should save as `VARCHAR`.\r\nDate/time data types can be disabled for now since they're not fully implemented on the backend.\r\n\r\n## Additional context\r\n<!-- Add any other context or screenshots about the feature request here.-->\r\n- Backend work:\r\n  - #532 to get the list of types \r\n  - #199 to get valid target types and change types \r\n- Design issue: #324 \r\n- Design discussion: #436\r\n- #269 \n", "before_files": [{"content": "from django.shortcuts import render, redirect, get_object_or_404\n\nfrom mathesar.models import Database, Schema, Table\nfrom mathesar.api.serializers.databases import DatabaseSerializer\nfrom mathesar.api.serializers.schemas import SchemaSerializer\nfrom mathesar.api.serializers.tables import TableSerializer\n\n\ndef get_schema_list(request, database):\n    schema_serializer = SchemaSerializer(\n        Schema.objects.filter(database=database),\n        many=True,\n        context={'request': request}\n    )\n    return schema_serializer.data\n\n\ndef get_database_list(request):\n    database_serializer = DatabaseSerializer(\n        Database.objects.all(),\n        many=True,\n        context={'request': request}\n    )\n    return database_serializer.data\n\n\ndef get_table_list(request, schema):\n    if schema is None:\n        return []\n    table_serializer = TableSerializer(\n        Table.objects.filter(schema=schema),\n        many=True,\n        context={'request': request}\n    )\n    return table_serializer.data\n\n\ndef get_common_data(request, database, schema=None):\n    return {\n        'current_db': database.name if database else None,\n        'current_schema': schema.id if schema else None,\n        'schemas': get_schema_list(request, database),\n        'databases': get_database_list(request),\n        'tables': get_table_list(request, schema)\n    }\n\n\ndef get_current_database(request, db_name):\n    # if there's a DB name passed in, try to retrieve the database, or return a 404 error.\n    if db_name is not None:\n        return get_object_or_404(Database, name=db_name)\n    else:\n        try:\n            # Try to get the first database available\n            return Database.objects.order_by('id').first()\n        except Database.DoesNotExist:\n            return None\n\n\ndef get_current_schema(request, schema_id, database):\n    # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.\n    if schema_id is not None:\n        return get_object_or_404(Schema, id=schema_id)\n    else:\n        try:\n            # Try to get the first schema in the DB\n            return Schema.objects.filter(database=database).order_by('id').first()\n        except Schema.DoesNotExist:\n            return None\n\n\ndef render_schema(request, database, schema):\n    # if there's no schema available, redirect to the schemas page.\n    if not schema:\n        return redirect('schemas', db_name=database.name)\n    else:\n        # We are redirecting so that the correct URL is passed to the frontend.\n        return redirect('schema_home', db_name=database.name, schema_id=schema.id)\n\n\ndef home(request):\n    database = get_current_database(request, None)\n    schema = get_current_schema(request, None, database)\n    return render_schema(request, database, schema)\n\n\ndef db_home(request, db_name):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, None, database)\n    return render_schema(request, database, schema)\n\n\ndef schema_home(request, db_name, schema_id):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, schema_id, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n\n\ndef schemas(request, db_name):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, None, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n", "path": "mathesar/views.py"}], "after_files": [{"content": "from django.shortcuts import render, redirect, get_object_or_404\n\nfrom mathesar.models import Database, Schema, Table\nfrom mathesar.api.serializers.databases import DatabaseSerializer, TypeSerializer\nfrom mathesar.api.serializers.schemas import SchemaSerializer\nfrom mathesar.api.serializers.tables import TableSerializer\n\n\ndef get_schema_list(request, database):\n    schema_serializer = SchemaSerializer(\n        Schema.objects.filter(database=database),\n        many=True,\n        context={'request': request}\n    )\n    return schema_serializer.data\n\n\ndef get_database_list(request):\n    database_serializer = DatabaseSerializer(\n        Database.objects.all(),\n        many=True,\n        context={'request': request}\n    )\n    return database_serializer.data\n\n\ndef get_table_list(request, schema):\n    if schema is None:\n        return []\n    table_serializer = TableSerializer(\n        Table.objects.filter(schema=schema),\n        many=True,\n        context={'request': request}\n    )\n    return table_serializer.data\n\n\ndef get_type_list(request, database):\n    if database is None:\n        return []\n    type_serializer = TypeSerializer(\n        database.supported_types,\n        many=True,\n        context={'request': request}\n    )\n    return type_serializer.data\n\n\ndef get_common_data(request, database, schema=None):\n    return {\n        'current_db': database.name if database else None,\n        'current_schema': schema.id if schema else None,\n        'schemas': get_schema_list(request, database),\n        'databases': get_database_list(request),\n        'tables': get_table_list(request, schema),\n        'abstract_types': get_type_list(request, database)\n    }\n\n\ndef get_current_database(request, db_name):\n    # if there's a DB name passed in, try to retrieve the database, or return a 404 error.\n    if db_name is not None:\n        return get_object_or_404(Database, name=db_name)\n    else:\n        try:\n            # Try to get the first database available\n            return Database.objects.order_by('id').first()\n        except Database.DoesNotExist:\n            return None\n\n\ndef get_current_schema(request, schema_id, database):\n    # if there's a schema ID passed in, try to retrieve the schema, or return a 404 error.\n    if schema_id is not None:\n        return get_object_or_404(Schema, id=schema_id)\n    else:\n        try:\n            # Try to get the first schema in the DB\n            return Schema.objects.filter(database=database).order_by('id').first()\n        except Schema.DoesNotExist:\n            return None\n\n\ndef render_schema(request, database, schema):\n    # if there's no schema available, redirect to the schemas page.\n    if not schema:\n        return redirect('schemas', db_name=database.name)\n    else:\n        # We are redirecting so that the correct URL is passed to the frontend.\n        return redirect('schema_home', db_name=database.name, schema_id=schema.id)\n\n\ndef home(request):\n    database = get_current_database(request, None)\n    schema = get_current_schema(request, None, database)\n    return render_schema(request, database, schema)\n\n\ndef db_home(request, db_name):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, None, database)\n    return render_schema(request, database, schema)\n\n\ndef schema_home(request, db_name, schema_id):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, schema_id, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n\n\ndef schemas(request, db_name):\n    database = get_current_database(request, db_name)\n    schema = get_current_schema(request, None, database)\n    return render(request, 'mathesar/index.html', {\n        'common_data': get_common_data(request, database, schema)\n    })\n", "path": "mathesar/views.py"}]}