37 lines
		
	
	
		
			936 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			936 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # SPDX-License-Identifier: Apache-2.0
 | |
| 
 | |
| cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
 | |
| import="docker run -i --rm --net=host \
 | |
|   --volume "$(pwd)/../:/opt/scripts/" \
 | |
|   surrealdb/surrealdb:latest import \
 | |
|   --endpoint http://127.0.0.1:8000 \
 | |
|   --username root --password root \
 | |
|   --namespace testing --database testbrain"
 | |
| 
 | |
| sql="docker run -i --rm --net=host \
 | |
|   surrealdb/surrealdb:latest sql \
 | |
|   --hide-welcome \
 | |
|   --endpoint http://127.0.0.1:8000 \
 | |
|   --username root --password root \
 | |
|   --namespace testing --database testbrain"
 | |
| 
 | |
| echo DELETING EXISTING DATA:
 | |
| echo "REMOVE DATABASE testbrain;" | $sql
 | |
| 
 | |
| echo CREATING TABLES:
 | |
| $import /opt/scripts/tables.sql
 | |
| 
 | |
| echo LOADING FUNCTIONS:
 | |
| $import /opt/scripts/functions.sql
 | |
| 
 | |
| echo LOADING MOCK DATA:
 | |
| $import /opt/scripts/testing/data.sql
 | |
| 
 | |
| echo RUN TIMER FUNCTION:
 | |
| $import /opt/scripts/timer.sql
 | |
| 
 | |
| echo CHECK IF DATA GOT MODIFIED CORRECTLY:
 | |
| $import /opt/scripts/testing/verification.sql
 |