import jingrow
from jingrow.patches.v14_0.drop_unused_indexes import drop_index_if_exists


def execute():
	if jingrow.db.db_type == "postgres":
		return

	db_tables = jingrow.db.get_tables(cached=False)

	child_tables = jingrow.get_all(
		"PageType",
		{"istable": 1, "is_virtual": 0},
		pluck="name",
	)

	for pagetype in child_tables:
		table = f"tab{pagetype}"
		if table not in db_tables:
			continue
		drop_index_if_exists(table, "modified")
