Compare commits
1 Commits
13336f8c17
...
1232ba036e
Author | SHA1 | Date |
---|---|---|
coolneng | 1232ba036e |
51
shell.nix
51
shell.nix
|
@ -21,38 +21,37 @@ in mkShell {
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
trap "kill 0" EXIT
|
trap "kill 0" EXIT
|
||||||
export PGDATA="${psql_dir}"
|
export PGDATA="${psql_dir}"
|
||||||
export PGHOST="${psql_dir}"
|
export PGHOST="${psql_dir}"
|
||||||
|
|
||||||
# Initialize PostgreSQL
|
# Initialize PostgreSQL
|
||||||
if [ ! -d ${psql_dir} ]; then
|
if [ ! -d ${psql_dir} ]; then
|
||||||
initdb --auth-local=trust --no-locale --encoding=UTF8
|
initdb --auth-local=trust --no-locale --encoding=UTF8
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pg_ctl status; then
|
if ! pg_ctl status; then
|
||||||
pg_ctl start -o "--unix_socket_directories=${psql_dir} --listen_addresses='''"
|
pg_ctl start -o "--unix_socket_directories=${psql_dir} --listen_addresses='''"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
psql -d postgres -f ${psql_file}
|
psql -d postgres -f ${psql_file}
|
||||||
|
|
||||||
# Initialize MySQL
|
# Initialize MySQL
|
||||||
if [ ! -d ${mysql_dir} ]; then
|
if [ ! -d ${mysql_dir} ]; then
|
||||||
mysqld --datadir="${mysql_dir}" --socket="${socket}" --initialize-insecure
|
mysqld --datadir="${mysql_dir}" --socket="${socket}" --initialize-insecure
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mysqld --datadir="${mysql_dir}" --socket="${socket}" --skip-networking &
|
mysqld --datadir="${mysql_dir}" --socket="${socket}" --skip-networking &
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
mysql --socket="${socket}" -u root < ${mysql_file}
|
mysql --socket="${socket}" -u root < ${mysql_file}
|
||||||
|
|
||||||
alias psql='psql -d postgres'
|
alias psql='psql -d postgres'
|
||||||
alias mysql='mysql --socket="${socket}" -u root'
|
alias mysql='mysql --socket="${socket}" -u root'
|
||||||
alias nuke='rm -rf ${psql_dir} ${mysql_dir}'
|
alias nuke='rm -rf ${psql_dir} ${mysql_dir}'
|
||||||
|
|
||||||
alembic upgrade head
|
alembic upgrade head
|
||||||
pgloader ${origin} ${destination}
|
pgloader ${origin} ${destination}
|
||||||
pg_dump odyfo > databases/migrated_db.sql
|
pg_dump odyfo > databases/migrated_db.sql
|
||||||
>>>>>>> parent of fcc06ae (Fix pgloader database URI)
|
'';
|
||||||
'';
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue