mirror of
https://github.com/Lemonochrme/service-architecture.git
synced 2025-06-08 05:30:50 +02:00
27 lines
773 B
Bash
Executable file
27 lines
773 B
Bash
Executable file
#!/bin/bash
|
|
|
|
source ./db/db.sh
|
|
|
|
check_env
|
|
echo "> Creating database 'service-architecture'..."
|
|
if ! mariadb -u "$user" -p"$pwd" -e "CREATE DATABASE IF NOT EXISTS \`service-architecture\`;"
|
|
then
|
|
echo -e $RED"Error: Failed to create database, check your .env"$RESET
|
|
exit 1
|
|
fi
|
|
|
|
echo "> Uploading database 'service-architecture'..."
|
|
if ! mariadb -u "$user" -p"$pwd" "service-architecture" < db/db.sql
|
|
then
|
|
echo -e $RED"Error: Failed to execute db.sql, contact the maintainers."$RESET
|
|
exit 1
|
|
fi
|
|
|
|
echo "> Populating database 'service-architecture'..."
|
|
if ! mariadb -u "$user" -p"$pwd" "service-architecture" < db/init.sql
|
|
then
|
|
echo -e $RED"Error: Failed to execute init.sql, contact the maintainers."$RESET
|
|
exit 1
|
|
fi
|
|
|
|
echo -e $GREEN"Database setup successful!"$RESET
|