@domenico
To add columns to the auth_user table in Django with PostgreSQL, you can create a migration using the following steps:
- Create a new model with the additional fields you want to add to the auth_user table. For example, if you want to add a "phone_number" field, you can create a model like this:
1
2
3
4
|
from django.contrib.auth.models import AbstractUser
class CustomUser(AbstractUser):
phone_number = models.CharField(max_length=20, blank=True, null=True)
|
- Run python manage.py makemigrations to create a migration file for the new model.
- Run python manage.py migrate to apply the migration and create the new table.
- Create a data migration (if needed) to populate the new columns with data.
- You may also need to update the User model in the admin panel to include the new fields.
By following these steps, you can add columns to the auth_user table in Django with PostgreSQL.