Fix MySQL database creation script
This commit is contained in:
parent
c3ce963858
commit
dc69f3d7f8
|
@ -6,6 +6,6 @@ USE odyfo;
|
||||||
|
|
||||||
source databases/production_db.sql;
|
source databases/production_db.sql;
|
||||||
|
|
||||||
USE test;
|
USE test_odyfo;
|
||||||
|
|
||||||
source databases/test_db.sql;
|
source databases/test_db.sql;
|
||||||
|
|
10
shell.nix
10
shell.nix
|
@ -5,7 +5,7 @@ with pkgs;
|
||||||
let
|
let
|
||||||
psql_file = "psql_creation.sql";
|
psql_file = "psql_creation.sql";
|
||||||
psql_dir = "$(pwd)/.pgdata";
|
psql_dir = "$(pwd)/.pgdata";
|
||||||
mysql_file = "databases/mysql_creation.sql";
|
mysql_file = "mysql_creation.sql";
|
||||||
mysql_dir = "$(pwd)/.mysql";
|
mysql_dir = "$(pwd)/.mysql";
|
||||||
socket = "${mysql_dir}/mysql.sock";
|
socket = "${mysql_dir}/mysql.sock";
|
||||||
origin = "mysql:///odyfo";
|
origin = "mysql:///odyfo";
|
||||||
|
@ -34,9 +34,7 @@ in mkShell {
|
||||||
pg_ctl start -o "--unix_socket_directories=${psql_dir} --listen_addresses='''"
|
pg_ctl start -o "--unix_socket_directories=${psql_dir} --listen_addresses='''"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d ${psql_dir} ]; then
|
psql -d postgres -f ${psql_file}
|
||||||
psql -d postgres -f ${psql_file}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize MySQL
|
# Initialize MySQL
|
||||||
if [ ! -d ${mysql_dir} ]; then
|
if [ ! -d ${mysql_dir} ]; then
|
||||||
|
@ -46,9 +44,7 @@ in mkShell {
|
||||||
mysqld --datadir="${mysql_dir}" --socket="${socket}" --skip-networking &
|
mysqld --datadir="${mysql_dir}" --socket="${socket}" --skip-networking &
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
if [ ! -d ${mysql_dir} ]; then
|
mysql --socket="${socket}" -u root < ${mysql_file}
|
||||||
mysql --socket="${socket}" -u root < ${mysql_file}
|
|
||||||
fi
|
|
||||||
|
|
||||||
alias psql='psql -d postgres'
|
alias psql='psql -d postgres'
|
||||||
alias mysql='mysql --socket="${socket}" -u root'
|
alias mysql='mysql --socket="${socket}" -u root'
|
||||||
|
|
Loading…
Reference in New Issue