2. Working with Multiple Databases
2.1. Process for setting up the RESNET db from scratch
Create a new database in mysql. Make sure the character_set and collation were set to utf8mb4 and utf8mb4_general_ci respectively.
Set the RESNET_DATABASE_URL in the env vars (under config/settings/.env)
To create the schema for the new resnet db, run:
python manage.py migrate --database=resnet
To insert the metadata for the resnet db (questions, climate zones, …), run:
python manage.py load_dbdata --database=resnet
Now, you can use the import script for resnet data to insert resnet homes into this db. (TODO add expected filename and folder for resnet json)
2.2. Process for working with multiple databases
Migrations will be applied on both databases:
python manage.py migrate # for the primary db. Optionally, we can add `--database=default`
python manage.py migrate --database=resnet # for the resnet db.
Scripts will be applied to both databases. But, it is the responsibility of the developer to write the necessary code to have the script run over both dbs or just one of them.