From b5f46eb157a01ad16c399f3bbdf9a6c7daca2790 Mon Sep 17 00:00:00 2001 From: Luke Murphy <lukewm@riseup.net> Date: Fri, 20 Mar 2020 13:44:11 +0100 Subject: [PATCH] Add makefile target to reload DB --- Makefile | 8 +++++++ internewshid/hid/fixtures/sudan.json | 36 ++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/Makefile b/Makefile index b89b5fc1..16a3825e 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,7 @@ MANAGEPY := python manage.py PIPENVRUN := pipenv run PROJECT_ROOT := . SOURCE_DIR := $(PROJECT_ROOT)/$(PROJECT_NAME)/ +FIXTURES_DIR := $(PROJECT_NAME)/hid/fixtures lint: @$(PIPENVRUN) pylava -o setup.cfg $(SOURCE_DIR) @@ -15,3 +16,10 @@ sort: test: @$(PIPENVRUN) pytest --cov=$(PROJECT_NAME) .PHONY: test + +sudan-db-reset: + $(PIPENVRUN) $(MANAGEPY) reset_db && \ + $(PIPENVRUN) $(MANAGEPY) migrate && \ + $(PIPENVRUN) $(MANAGEPY) loaddata $(FIXTURES_DIR)/sudan.json && \ + $(PIPENVRUN) $(MANAGEPY) loaddata $(FIXTURES_DIR)/taxonomies.json +.PHONY: sudan-db-reset diff --git a/internewshid/hid/fixtures/sudan.json b/internewshid/hid/fixtures/sudan.json index dc933f45..614cba5d 100644 --- a/internewshid/hid/fixtures/sudan.json +++ b/internewshid/hid/fixtures/sudan.json @@ -102,5 +102,41 @@ }, "model": "data_layer.customconstance", "pk": 1 + }, + { + "fields": { + "area_of_specialisation": "", + "business_address": "", + "business_email": "user@example.com", + "business_tel": "", + "contact_type": "", + "country": "", + "date_joined": "2018-10-10T12:17:49.867Z", + "fax": "", + "first_name": "User", + "gender": "", + "groups": [], + "home_address": "", + "home_tel": "", + "is_active": true, + "is_staff": true, + "is_superuser": true, + "job_title": "", + "last_login": "2018-10-18T13:48:12.398Z", + "last_name": "Example", + "mobile": "", + "msn_id": "", + "nationality": "", + "notes": "", + "password": "pbkdf2_sha256$36000$15tPyazbIfk8$NM0Ir7ZnK2ukElrteRhmtBW4Ga6Rn3fePQCw/ZOrYpA=", + "personal_email": "", + "picture": "", + "skype_id": "", + "title": "", + "user_permissions": [], + "yahoo_messenger": "" + }, + "model": "users.user", + "pk": 1 } ] -- GitLab