summaryrefslogtreecommitdiff
path: root/sl2ls.sh
blob: fcbf031f633a308f37fb43efc8eccdd70425def6 (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. psql template1 -c "DROP DATABASE ${LSDB};"
  14. pg_dump ${SLDB} > sl2ls.sql
  15. sed -i -e "s/${SLOWN}/${LSOWN}/" sl2ls.sql
  16. sed -i -e "s/SQL_ASCII/LATIN1/" sl2ls.sql
  17. createdb -O ${LSOWN} ${LSDB}
  18. psql ${LSDB} ${LSOWN} -c "\i /usr/local/ledger-smb/sql/Pg-central.sql"
  19. psql template1 -c "ALTER USER ${LSOWN} WITH superuser;"
  20. psql ${LSDB} ${LSOWN} -c "\i sl2ls.sql"
  21. psql template1 -c "ALTER USER ${LSOWN} WITH nosuperuser;"
  22. cd /usr/local/ledger-smb/sql/legacy/
  23. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  24. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.12-2.6.17.sql"
  25. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  26. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.17-2.6.18.sql"
  27. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  28. psql ${LSDB} ${LSOWN} -c "\i Pg-upgrade-2.6.18-2.6.19.sql"
  29. echo '###############################################################'
  30. echo
  31. echo 'Should error with--> ERROR: column "version" does not exist'
  32. echo
  33. echo '###############################################################'
  34. psql ${LSDB} ${LSOWN} -c "SELECT version FROM defaults;"
  35. psql ${LSDB} ${LSOWN} -c "update users_conf set password = md5('apasswrd');"
  36. cd /usr/local/ledger-smb
  37. ./import_members.pl users/members
  38. psql ${LSDB} ${LSOWN} -c "SELECT * FROM users;"
  39. exit