Skip to content
This repository has been archived by the owner on Jun 2, 2021. It is now read-only.

NeCTAR-RC/crams-migration

Repository files navigation

rcportal migration

For migrating across rcallocation request data from NeCTAR rcportal database over to CRAMS database.

Pre-Setup

  • Git clone this project.
  • This setup assumes you are migrating from MySQL to MySQL database and the target MySQL database has been setup.

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

Setup Virtual Environment

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

Setting up source database

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.

To run migration:

Setup the source and target database in:

	rcportal_migration/settings.py
  1. Create the database schema of your target db by running:

     python manage.py migrate --database='crams_db'
    
  2. 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

  3. 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
  4. Validate the migration data - this will do a diff check on the db source and db target.

     python manage.py migrationvalidate
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages