Skip to content
Snippets Groups Projects
Commit cd9d3745 authored by Tanner Prestegard's avatar Tanner Prestegard Committed by GraceDB
Browse files

Convert gstlal-spiir-gpu account to RobotUser

parent 548658c4
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-17 18:24
from __future__ import unicode_literals
from django.db import migrations
username = 'gstlal-spiir-gpu'
def add_robotuser(apps, schema_editor):
User = apps.get_model('auth', 'User')
RobotUser = apps.get_model('ligoauth', 'RobotUser')
# Get user account
user = User.objects.get(username=username)
# Create RobotUser account with user_ptr and update dict
r_user = RobotUser.objects.create(user_ptr=user)
r_user.__dict__.update(user.__dict__)
r_user.save()
def remove_robotuser(apps, schema_editor):
RobotUser = apps.get_model('ligoauth', 'RobotUser')
# Delete RobotUser, keep parent User
r_user = RobotUser.objects.get(username=username)
r_user.delete(keep_parents=True)
class Migration(migrations.Migration):
dependencies = [
('ligoauth', '0012_rename_localuser_to_robotuser'),
]
operations = [
migrations.RunPython(add_robotuser, remove_robotuser),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment