import jingrow


def execute():
	column = "apply_user_permissions"
	to_remove = ["PagePerm", "Custom PagePerm"]

	for pagetype in to_remove:
		if jingrow.db.table_exists(pagetype):
			if column in jingrow.db.get_table_columns(pagetype):
				jingrow.db.sql(f"alter table `tab{pagetype}` drop column {column}")

	jingrow.reload_pg("core", "pagetype", "pageperm", force=True)
	jingrow.reload_pg("core", "pagetype", "custom_pageperm", force=True)
