hackforla / peopledepot

A project to setup a datastore for people and projects at HackforLA. The link below takes you to the code documentation
https://hackforla.github.io/peopledepot/
GNU General Public License v2.0
5 stars 24 forks source link

Add seed data permission type 278 #303

Open freaky4wrld opened 3 weeks ago

freaky4wrld commented 3 weeks ago

Fixes #278

What changes did you make?

Why did you make the changes (we will use this info to test)?

freaky4wrld commented 2 weeks ago

@fyliu added the missing lines in the file, just a question do we still need postgresql added, or we can skip that???

fyliu commented 2 weeks ago

@freaky4wrld I think we should skip it. There's several other management commands dealing with databases but I think dbshell is the only one that needs psql.

fyliu commented 2 weeks ago

@freaky4wrld I'm still having trouble seeing the data inserted into the database. Can you check if this happens to you too?

Here are my steps:

# build and run the container in the right branch
./script/buildrun.sh
# I also tried it with the -v option to delete and start from a fresh data volume

# make sure data/0004 migration is applied
docker-compose exec -T web python manage.py showmigrations data

# check permissiontype table data
./scripts/db.sh -c "select * from core_permissiontype;"
# shows empty table

# check sdg table has data
./scripts/db.sh -c "select * from core_sdg;"

# show core tables with extended info (size and desc)
./scripts/db.sh -c "\dt+ core*"
# shows that core_permissiontype is essentially empty

# more debug attempt: unapply and reapply the migration
./scripts/migrate.sh data 0003
./scripts/migrate.sh data 0004
# I checked and the table is still empty

I made the following change to db.sh

set -x
# example:
#   ./scripts/db.sh -c "select * from core_permissiontype;"
docker-compose exec db psql -d people_depot_dev -U people_depot "$@"
freaky4wrld commented 2 weeks ago

@fyliu yep the seed data doesn't display irrespective of the changes you made in the db.sh. Don't know how it happened but I made sure it shows the seed data in the db-table... should I run the script again to insert the data into the db-table