[Update] 更新迁移脚本

pull/1197/head
ibuler 2018-04-12 17:02:04 +08:00
parent ee4f5a8194
commit 8dfdefd428
1 changed files with 6 additions and 0 deletions

View File

@ -3,6 +3,7 @@
python ../apps/manage.py shell << EOF
from perms.models import *
from assets.models import SystemUser
for old in NodePermission.objects.all():
perm = AssetPermission.objects.create(
@ -20,5 +21,10 @@ for old in NodePermission.objects.all():
perm.user_groups.add(old.user_group)
perm.nodes.add(old.node)
perm.system_users.add(old.system_user)
for s in SystemUser.objects.all():
nodes = list(s.nodes.all())
s.nodes.set([])
s.nodes.set(nodes)
EOF