We three working with Django and postgres is the database. Whenever we push the code to GitHub. The database data is not reflecting. The data I stored is visible to me only. The postgres user, password and database name are same on all our laptops. How to make when I push that has to go their databases also.
0
votes
2 Answers
0
votes
If you are talking about changes in db schema, then take a look django migrations - https://docs.djangoproject.com/en/3.1/topics/migrations/. The workflow is following:
- change model (e.g. add new field, change existing field...)
- generate migration file by running
python manage.py makemigrations
. This generates migration file in<app_folder>/migrations
- Run
python manage.py migrate
to apply changes in models to your database - Add migration file to your version control (github or whaever) and push it
Now when your colleagues gets updated code from version control they need to run python manage.py migrate
to apply model changes to their local database.
0
votes
I found that it is not possible to send postgress data directly. But sqlite can be used for it. This link aids in that - https://manuelvanrijn.nl/blog/2012/01/18/convert-postgresql-to-sqlite/ . But i send data by taking backup like From Postgres to Postgres: taking backup : pg_dump dbname > dbname.bak and then on new Postgres restored with: psql test < dbname.bak