mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
don't fix timestamps on postgresql
This commit is contained in:
parent
098998084d
commit
85f062c8f3
|
@ -214,21 +214,18 @@ def cli_run(ctx: click.Context, dev: bool = False) -> None:
|
||||||
|
|
||||||
|
|
||||||
@cli.command('db-maintenance')
|
@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
|
@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'
|
'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":
|
if ctx.obj.config.db_type == "postgres":
|
||||||
return
|
return
|
||||||
|
|
||||||
with ctx.obj.database.session(False) as conn:
|
with ctx.obj.database.session(False) as s:
|
||||||
with conn.execute("VACUUM"):
|
with s.transaction():
|
||||||
|
s.fix_timestamps()
|
||||||
|
|
||||||
|
with s.execute("VACUUM"):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue