import click

import jingrow


def execute():
	pagetype = "Data Import Legacy"
	table = jingrow.utils.get_table_name(pagetype)

	# delete the pagetype record to avoid broken links
	jingrow.delete_pg("PageType", pagetype, force=True)

	# leaving table in database for manual cleanup
	click.secho(
		f"`{pagetype}` has been deprecated. The PageType is deleted, but the data still"
		" exists on the database. If this data is worth recovering, you may export it"
		f" using\n\n\tbench --site {jingrow.local.site} backup -i '{pagetype}'\n\nAfter"
		" this, the table will continue to persist in the database, until you choose"
		" to remove it yourself. If you want to drop the table, you may run\n\n\tbench"
		f" --site {jingrow.local.site} execute jingrow.db.sql --args \"('DROP TABLE IF"
		f" EXISTS `{table}`', )\"\n",
		fg="yellow",
	)
