Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration script from sqlite to mysql #210

Open
jfberry opened this issue Dec 7, 2020 · 1 comment
Open

Migration script from sqlite to mysql #210

jfberry opened this issue Dec 7, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@jfberry
Copy link
Collaborator

jfberry commented Dec 7, 2020

As a sqlite user I would like to upgrade to mysql so that I can take advantage of backups and other mysql related tools (eg poracleweb project)

@jfberry jfberry added enhancement New feature or request good first issue Good for newcomers labels Dec 7, 2020
@jfberry
Copy link
Collaborator Author

jfberry commented Dec 18, 2020

These steps confirmed working after my migration. Things are slightly more complicated now because we have upgraded the database schema since dropping support for sqlite.

  1. be on the latest version that supports sqlite -- git checkout 4350c45bf63ce1bc6c341f3a0b921238b106f1d6
  2. create an empty database like explained here https://muckelba.github.io/poracleWiki/v4/database.html (when granting the privileges make sure to be logged into mysql with root/mysql root)
  3. change database client in /config/local.json from sqlite to mysql and enter the credentials (remember 2nd step?)
  4. launch poracle and it will create the database. If you get an error referring to '767 specified key was too long' you will need to drop the database, adjust mysql/mariadb settings (see https://dba.stackexchange.com/questions/231219/mariadb-10-1-38-specified-key-was-too-long-max-key-length-is-767-bytes ) and go back to 2
  5. Navigate to PoracleJS/src/lib/db
    5a. Fix any broken date fields sqlite3 poracle.sqlite "update humans set last_checked='2021-01-01 12:00';"
  6. Dump existing database sqlite3 poracle.sqlite .dump | grep '^INSERT' | grep -v migrations > ~/insert.sql - this creates a file, insert.sql in your home directory
  7. run mysql command line mysql (again, as root so either log in with root or sudo mysql)
  8. change to poracle database use poracle;
  9. load freshly created insert script source ~/insert.sql
  10. I'd suggest making sure poracle runs now - change your config to use mysql and fire it up and make sure it can process some hooks
  11. switch to latest version - git checkout develop - database should now migrate to latest schema

@jfberry jfberry removed the good first issue Good for newcomers label Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant