Import database creation script the first time

This commit is contained in:
coolneng 2021-05-06 00:08:56 +02:00
parent 403f27526d
commit 94249d2c72
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
2 changed files with 7 additions and 2 deletions

View File

@ -21,7 +21,9 @@ in mkShell {
mysqld --datadir="${data_dir}" --socket="${socket}" --skip-networking --skip-mysqlx & mysqld --datadir="${data_dir}" --socket="${socket}" --skip-networking --skip-mysqlx &
sleep 1 sleep 1
if [ ! -d ${data_dir} ]; then
mysql --socket="${socket}" -u root < ${sql_file} mysql --socket="${socket}" -u root < ${sql_file}
fi
alias mysql='mysql --socket="${socket}" -u root' alias mysql='mysql --socket="${socket}" -u root'
alias nuke='rm -rf ${data_dir}' alias nuke='rm -rf ${data_dir}'

View File

@ -22,7 +22,10 @@ in mkShell {
pg_ctl start -o "--unix_socket_directories=${data_dir} --listen_addresses='''" pg_ctl start -o "--unix_socket_directories=${data_dir} --listen_addresses='''"
fi fi
if [ ! -d ${data_dir} ]; then
psql -d postgres -f ${sql_file} psql -d postgres -f ${sql_file}
fi
alias psql='psql -d postgres' alias psql='psql -d postgres'
alias nuke='rm -rf ${data_dir}' alias nuke='rm -rf ${data_dir}'
''; '';