Fix MySQL database creation script

This commit is contained in:
coolneng 2021-02-08 02:53:21 +01:00
parent c3ce963858
commit dc69f3d7f8
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 4 additions and 8 deletions

View File

@ -6,6 +6,6 @@ USE odyfo;
source databases/production_db.sql;
USE test;
USE test_odyfo;
source databases/test_db.sql;

View File

@ -5,7 +5,7 @@ with pkgs;
let
psql_file = "psql_creation.sql";
psql_dir = "$(pwd)/.pgdata";
mysql_file = "databases/mysql_creation.sql";
mysql_file = "mysql_creation.sql";
mysql_dir = "$(pwd)/.mysql";
socket = "${mysql_dir}/mysql.sock";
origin = "mysql:///odyfo";
@ -34,9 +34,7 @@ in mkShell {
pg_ctl start -o "--unix_socket_directories=${psql_dir} --listen_addresses='''"
fi
if [ ! -d ${psql_dir} ]; then
psql -d postgres -f ${psql_file}
fi
# Initialize MySQL
if [ ! -d ${mysql_dir} ]; then
@ -46,9 +44,7 @@ in mkShell {
mysqld --datadir="${mysql_dir}" --socket="${socket}" --skip-networking &
sleep 5
if [ ! -d ${mysql_dir} ]; then
mysql --socket="${socket}" -u root < ${mysql_file}
fi
alias psql='psql -d postgres'
alias mysql='mysql --socket="${socket}" -u root'