Skip to content

Commit

Permalink
Eregcsc 2010 permission groups (#898)
Browse files Browse the repository at this point in the history
* Add new fixtures and update readme

* initial commit

* content type for local.seed

* dj obj moved to cmcs_eregulations from regulations

* moved content type and admin fixtures to cmcs

* update object name in make file

* updating populate_content lamba for groups

* fix typo

* update file path for content type

* changed order of seed

* attempt to fix tuple object error

* added comma.
  • Loading branch information
thwalker6 authored Jul 25, 2023
1 parent 2cc1c2f commit e6decc7
Show file tree
Hide file tree
Showing 15 changed files with 7,710 additions and 4,822 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ If adding a new model to this process please refer to the adding a new model pro

1. Connect to the VPN and run the following command below for postgresql in the command line. Replace db_address and port_number with the database address and port number respectively. A file called `backup.sql` should populate in the directory the command is run in.
```
pg_dump -h <db_address> -p <port_number> -U eregsuser -f backup.sql -t 'search_sy*' -t 'resources_*' -t 'regulations_statute*' --data-only --column-inserts eregs
pg_dump -h <db_address> -p <port_number> -U eregsuser -f backup.sql -t 'search_sy*' -t 'resources_*' -t 'regulations_*' -t 'auth_g*' -t 'auth_permission' -t 'django_content_type' --data-only --column-inserts eregs
```
2. Run the command `make python.emptyseedtables`. This will clear out many of our resources tables and the synonym table for population of the database.
3. Run the postges script `backup.sql` produced in step 2 on your local database. This will update your database with up to date production data.
Expand Down
19 changes: 13 additions & 6 deletions solution/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,21 @@ python.makemigrations:
python.migrate:
docker-compose exec regulations python manage.py migrate

objects = resources.abstractcategory resources.category resources.subcategory resources.abstractlocation resources.section resources.subpart resources.federalregisterdocumentgroup resources.resourcesconfiguration resources.abstractresource resources.federalregisterdocument resources.supplementalcontent
# Do not change the order of these objects. In some cases it matters
resource_objects = resources.abstractcategory resources.category resources.subcategory resources.abstractlocation resources.section resources.subpart resources.federalregisterdocumentgroup resources.resourcesconfiguration resources.abstractresource resources.federalregisterdocument resources.supplementalcontent
reg_objects = regulations.siteconfiguration regulations.statutelinkconfiguration regulations.statutelinkconverter
auth_objects = contenttypes.contenttype auth.permission auth.group

local.seed:
$(foreach object, $(objects), docker-compose exec regulations python manage.py loaddata $(object).json;) \
docker-compose exec regulations python manage.py loaddata search.synonym.json
docker-compose exec regulations python manage.py loaddata regulations.statutelinkconverter.json
$(foreach object, $(resource_objects), docker-compose exec regulations python manage.py loaddata $(object).json;) \
$(foreach object, $(reg_objects), docker-compose exec regulations python manage.py loaddata $(object).json;) \
$(foreach object, $(auth_objects), docker-compose exec regulations python manage.py loaddata cmcs_regulations/fixtures/$(object).json;) \
docker-compose exec regulations python manage.py loaddata search.synonym.json


local.dump:
$(foreach object, $(objects), docker-compose exec regulations python manage.py dumpdata $(object) --indent 4 > ./backend/resources/fixtures/$(object).json;) \
docker-compose exec regulations python manage.py dumpdata search.synonym --indent 4 > ./backend/regcore/search/fixtures/search.synonym.json
docker-compose exec regulations python manage.py dumpdata regulations.statutelinkconverter --indent 4 > ./backend/regulations/fixtures/regulations.statutelinkconverter.json
$(foreach object, $(reg_objects), docker-compose exec regulations python manage.py dumpdata $(object) --indent 4 > ./backend/regulations/fixtures/$(object).json;) \
$(foreach object, $(auth_objects), docker-compose exec regulations python manage.py dumpdata $(object) --indent 4 > ./backend/cmcs_regulations/fixtures/$(object).json;) \
docker-compose exec regulations python manage.py dumpdata contenttypes.contenttype --indent 4 > ./backend/cmcs_regulations/fixtures/contenttypes.contenttype.json
docker-compose exec regulations python manage.py dumpdata search.synonym --indent 4 > ./backend/regcore/search/fixtures/search.synonym.json
Loading

0 comments on commit e6decc7

Please sign in to comment.