# Copyright (c) 2021, JINGROW
# For license information, please see license.txt


import jingrow


def execute():
	scheme_before = jingrow.db.auto_commit_on_many_writes
	jingrow.db.auto_commit_on_many_writes = True
	jingrow.reload_pg("jcloud", "pagetype", "team")

	teams = jingrow.get_all("Team", pluck="name")
	for team in teams:
		jingrow.get_pg("Team", team).save()

	jingrow.db.auto_commit_on_many_writes = scheme_before
