Database Service (WIP)
This repository is a part of the Open Energy Data Plattform If you are not actively developing the platform, clone this via the Open Energy Data Plattform repositoryc
Database Structure
Tables
Device
- device_id (AI, index)
- UUID
Attribute
- device_id
- parameter_id
- value
An attribute represents a key value pair assigned to a device. The device is specified by its id, the key specified as a parameter. Each attribute can be though of as a cell of a table
Parameter
- parameter_id (AI, index)
- name
- description
A parameter represents a key in a key value pair (attribute) that can be assigned to a device. In a table, it can be though of as a column.
Available Parameter types (Can be expanded)
- created (timestamp)
- updated (timestamp)
- creator (id)
- device_type (name)
- location (lat_long)
- street
- country
- city
- postal_code
- ch0_type
- ch0_ratio
- ch1_type
- ch1_ratio
- ch2_type
- ch2_ratio
- ch3_type
- ch3_ratio
- ch4_type
- ch4_ratio
- ch5_type
- ch5_ratio
- ch6_type
- ch6_ratio
- ch7_type
- ch7_ratio
Organisation
- organization_id (AI, index)
- name
- street
- city
- postal_code
This table handles all organizations. Each user belongs to an organization.
User
- user_id (AI, index)
- organization_id
- password_hash
- role
- first_name
- last_name
- phone
- street
- city
- postal_code
This table is used to both store information about the users in the management system, as well as to authenticate access requests to the management UI and the database. JWT can be created for each one of the users.
Usage
Initializing (First start)
You can specify the credentials by changing the variables in userdata.env
MARIADB_USER=example-user
MARIADB_PASSWORD=my_cool_secret
MARIADB_ROOT_PASSWORD=my-secret-pw
You can then run docker-compose up --build
Make sure that no containers or volumes are still present from previous installations. (docker-compose down -v
)
During building (more specifically during the first run) the users are created and the database schema is imported.
Starting
You can start the DB & PhpMyAdmin using docker-compose up
Stopping
You can stop the DB & PhpMyAdmin using docker-compose stop
or ctrl-c
if not detached.
This will not remove the volumes, the data stays persistent.
Removing
docker-compose down -v
This will remove all networks and volumes. The data will be removed.
Credits
- Manuel Pitz ✉️, Institute for Automation of Complex Power Systems, RWTH Aachen University
- Vincent Bareiß✉️, Institute for Automation of Complex Power Systems, RWTH Aachen University