From 85f062c8f3107eabac39be2cd6d0ae2078380e71 Mon Sep 17 00:00:00 2001 From: Izalia Mae Date: Sat, 28 Sep 2024 06:59:09 -0400 Subject: [PATCH] don't fix timestamps on postgresql --- relay/manage.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/relay/manage.py b/relay/manage.py index b76443d..e1dfce5 100644 --- a/relay/manage.py +++ b/relay/manage.py @@ -214,21 +214,18 @@ def cli_run(ctx: click.Context, dev: bool = False) -> None: @cli.command('db-maintenance') -@click.option('--fix-timestamps', '-t', is_flag = True, - help = 'Make sure timestamps in the database are float values') @click.pass_context -def cli_db_maintenance(ctx: click.Context, fix_timestamps: bool) -> None: +def cli_db_maintenance(ctx: click.Context) -> None: 'Perform maintenance tasks on the database' - if fix_timestamps: - with ctx.obj.database.session(True) as conn: - conn.fix_timestamps() - if ctx.obj.config.db_type == "postgres": return - with ctx.obj.database.session(False) as conn: - with conn.execute("VACUUM"): + with ctx.obj.database.session(False) as s: + with s.transaction(): + s.fix_timestamps() + + with s.execute("VACUUM"): pass