From dc69f3d7f8f1ff019d78d9f99c2bb46f5f56c599 Mon Sep 17 00:00:00 2001 From: coolneng Date: Mon, 8 Feb 2021 02:53:21 +0100 Subject: [PATCH] Fix MySQL database creation script --- mysql_creation.sql | 2 +- shell.nix | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mysql_creation.sql b/mysql_creation.sql index 4f31025..298f39b 100644 --- a/mysql_creation.sql +++ b/mysql_creation.sql @@ -6,6 +6,6 @@ USE odyfo; source databases/production_db.sql; -USE test; +USE test_odyfo; source databases/test_db.sql; diff --git a/shell.nix b/shell.nix index 8eefc0e..d019c17 100644 --- a/shell.nix +++ b/shell.nix @@ -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 + psql -d postgres -f ${psql_file} # 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 + mysql --socket="${socket}" -u root < ${mysql_file} alias psql='psql -d postgres' alias mysql='mysql --socket="${socket}" -u root'