From e32048d3c6c06679eeb7384e9f0d7bba49cf27f8 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sun, 1 Sep 2019 22:55:02 +1000 Subject: [PATCH] Add documentation for data migration --- docs/index.rst | 1 + docs/migrate.rst | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 docs/migrate.rst diff --git a/docs/index.rst b/docs/index.rst index c90ff2fe25..5e7279066f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -14,6 +14,7 @@ InvenTree Source Documentation Tables REST API Backup and Restore + Migrate Data InvenTree Modules Module Reference diff --git a/docs/migrate.rst b/docs/migrate.rst new file mode 100644 index 0000000000..78dfb39a6a --- /dev/null +++ b/docs/migrate.rst @@ -0,0 +1,33 @@ +Migrating Data +============== + +.. toctree:: + :titlesonly: + :maxdepth: 2 + :caption: Migrating Data + :hidden: + +In the case that data needs to be migrated from one database installation to another, the following procedure can be used to export data, initialize the new database, and re-import the data. + +Export Data +----------- + +``python3 manage.py dumpdata --exclude contenttypes --exclude auth.permission --indent 2 > data.json`` + +This will export all data (including user information) to a json data file. + +Initialize Database +------------------- + +Configure the new database using the normal processes (see `Getting Started `_): + +``python3 manage.py makemigrations`` + +``python3 manage.py migrate --run-syncdb`` + +Import Data +----------- + +The new database should now be correctly initialized with the correct table structures requried to import the data. + +``python3 manage.py loaddata data.json`` \ No newline at end of file