# Database initialisation
The script `init_schema.py` is used to initialise the schema of the task database, and to clear out its contents.
It should be passed the hostname and the port number on which the task database is accessible, as follows:
```
./init_schema.py --db_port 30036 --db_host 192.168.59.101
```
If using `minikube`, these values can be determined using the command:
```
minikube service --url mysql -n=plato
```
The values supplied are automatically saved in the configuration file in the directory `data/datadir_local`, which means that all future calls to the EAS Control Python scripts will automatically know where to find the task database.
The table structure of the EAS task database is as follows:
* `eas_task_types` -- A list of the types of task the pipeline is capable of running (i.e. the science codes it can run, and other house-keeping tasks it can run).
* `eas_task` -- A list of the tasks the pipeline is scheduled to run. A "task" in this context refers to a single call to a code in a single Docker container.
* `eas_scheduling_attempt` -- A list of all the times the pipeline has tried to run a task. Note that a single task may run multiple times, if the first execution attempt is interrupted.
* `eas_log_messages` -- All of the log messages (info, warning, error, etc) produced by tasks running within the pipeline.
* `eas_semantic_type` -- Strings which uniquely define each input/output file product from a task.
* `eas_product` -- All of the intermediate file products generated by all of the tasks in the `eas_task` table. Note that multiple copies of a single file product may be produced by different scheduling attempts, and these are all stored separately.
* `eas_product_version` -- All of the versions of intermediate file products which have been generated by tasks. File products are stored on disk with randomly-generated hexadecimal filenames to account for the fact that multiple copies of the same file product may exist.
* `eas_metadata_item` -- A table of metadata associated with tasks, scheduling attempts, file products, and file product versions. Metadata may either have floating-point values, or string values.
* `eas_metadata_keys` -- A conversion of metadata keywords to integers.
* `eas_task_input` -- A table of the intermediate file products that each task requires as input.