For migrating across rcallocation request data from NeCTAR rcportal database over to CRAMS database.
- Git clone this project.
- This setup assumes you are migrating from MySQL to MySQL database and the target MySQL database has been setup.
intall pip:
sudo apt-get install python3-pip
install tox:
sudo pip3 install tox
install mysql lib:
sudo apt-get install mysql-server
sudo apt-get install python3.5-dev
sudo apt-get install libmysqlclient-dev
Export mysql_config path if on mac os:
export PATH=$PATH:/usr/local/mysql/bin
From the project root directory, create the virtual environment by running the tox command:
tox -e py35
This will create ".tox/" directory, to activate the virtualenv run:
source .tox/bin/activate
The migration requires the keystone user list for it to map the keystone users to their allocation request.
A keystone user dump in csv form must be included in the "keystone_user" directory. The csv file only needs the "ID" and "Name" fields.
Setup the source and target database in:
rcportal_migration/settings.py
-
Create the database schema of your target db by running:
python manage.py migrate --database='crams_db'
-
Run django command to find the missing keystone users from source database
python manage.py findmissinguser
-
It will generate a file called "user_not_found_requests.csv" under "keystone_user" directory
-
Go through all user emails and find the current user in keystone based on the created_by id
-
Update missing_keystone_users.json
-
-
Start the django command to migrate the rcportal data into crams database
python manage.py rcportalmigrate
- any problems issues will be logged in the migration.log file
-
Validate the migration data - this will do a diff check on the db source and db target.
python manage.py migrationvalidate