Hi
I use the existing Postgres database for my project.
Some tables in my database need to use JSON / jsonb field.
I read how to inspect existing database along with adding an extra feature especially data type for Postgres as 3 links below
https://docs.djangoproject.com/en/3.1/howto/legacy-databases/
https://docs.djangoproject.com/en/3.1/ref/django-admin/#postgresql
https://docs.djangoproject.com/en/3.1/ref/contrib/postgres/#module-django.contrib.postgres
as my understanding, the article recommends me to install ‘django.contrib.postgres’ in INSTALLED_APPS in settings.py so I suppose that it is a build-in package from Django but we must manually install in settings.py
and then run python manage.py inspectdb
once I ran the command to inspect the existing database, it works well but the column “additional_info” that it is JSON field in the database still is models.TextField ( This field type is a guess) as the figure below.
1. how to fix this problem? OR ELSE do I have to install any addtional package ?
As I find out, there are a lot as below for extra feature in Posgres.
https://pypi.org/project/django-jsonfield-backport/
https://pypi.org/project/django-postgres-extensions/
https://pypi.org/project/django-contrib-postgres/
2. How to select only some tables in the existing database as desired to inspect in order to create models.py (not all tables in database)
Thank you
Trong