summaryrefslogtreecommitdiff
path: root/sl2ls.sh
blob: 85df5c6d2e4aba092385c3835cdc1e66f059b527 (plain)
  1. #
  2. #
  3. #
  4. # SQL-Ledger Dataset name and Dataset Owner
  5. #
  6. SLDB=sqlledger
  7. SLOWN=SQL-Ledger_Owner
  8. #
  9. # Ledger-SMB Dataset name and Dataset Owner
  10. #
  11. LSDB=lsmbprod
  12. LSOWN=ledgersmb
  13. # Installation directory
  14. IDIR=`pwd`
  15. psql template1 -c "DROP DATABASE ${LSDB};"
  16. pg_dump ${SLDB} > sl2ls.sql
  17. sed -i.orig -e "s/${SLOWN}/${LSOWN}/" sl2ls.sql
  18. sed -i.orig -e "s/SQL_ASCII/LATIN1/" sl2ls.sql
  19. createdb -O ${LSOWN} ${LSDB}
  20. psql ${LSDB} ${LSOWN} -c "\i ${IDIR}/sql/Pg-central.sql"
  21. psql template1 -c "ALTER USER ${LSOWN} WITH superuser;"
  22. psql ${LSDB} ${LSOWN} -c "\i sl2ls.sql"
  23. psql template1 -c "ALTER USER ${LSOWN} WITH nosuperuser;"
  24. cd ${IDIR}/sql/legacy/
  25. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  26. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.12-2.6.17.sql"
  27. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  28. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.17-2.6.18.sql"
  29. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  30. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.18-2.6.19.sql"
  31. echo '###############################################################'
  32. echo
  33. echo 'Should error with--> ERROR: column "version" does not exist'
  34. echo
  35. echo '###############################################################'
  36. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  37. psql ${LSDB} ${LSOWN} -c "update users_conf set password = md5('apasswrd');"
  38. cd ${IDIR}
  39. ./import_members.pl users/members
  40. psql ${LSDB} ${LSOWN} -c "SELECT * FROM users;"
  41. exit