feat: Add util to convert compressed tables to DYNAMIC
NOTE: This shouldn't be considered as a finished command. Only run this if you understand what you're doing
This commit is contained in:
parent
fb5b474f3a
commit
f0cc541a71
1 changed files with 24 additions and 0 deletions
|
|
@ -512,6 +512,29 @@ def console(context):
|
|||
IPython.embed(display_banner="", header="", colors="neutral")
|
||||
|
||||
|
||||
@click.command('convert-database')
|
||||
@pass_context
|
||||
def convert_database(context):
|
||||
"convert row_formats to DNAMIC from older formats -- innodb mariadb v10.6.3"
|
||||
site = get_site(context)
|
||||
frappe.init(site=site)
|
||||
frappe.connect()
|
||||
|
||||
information_schema = frappe.qb.Schema("information_schema")
|
||||
queried_tables = frappe.qb.from_(
|
||||
information_schema.tables
|
||||
).select("table_name").where(
|
||||
information_schema.tables.row_format=="Compressed"
|
||||
).run()
|
||||
tables = [x[0] for x in queried_tables]
|
||||
|
||||
for table in tables:
|
||||
frappe.db.sql(f"ALTER TABLE `{table}` ROW_FORMAT=DYNAMIC")
|
||||
|
||||
frappe.db.commit()
|
||||
frappe.destroy()
|
||||
|
||||
|
||||
@click.command('run-tests')
|
||||
@click.option('--app', help="For App")
|
||||
@click.option('--doctype', help="For DocType")
|
||||
|
|
@ -796,6 +819,7 @@ commands = [
|
|||
build,
|
||||
clear_cache,
|
||||
clear_website_cache,
|
||||
convert_database,
|
||||
jupyter,
|
||||
console,
|
||||
destroy_all_sessions,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue