Commit 13759341 authored by Aurélien Campéas's avatar Aurélien Campéas
Browse files

cli: migration of the start/end columns (series/snapshot)

parent c6ea46f63990
......@@ -287,10 +287,34 @@ def migrate_dot_6_to_dot_7(db_uri, namespace='tsh'):
f'foreign key (serie) references "{namespace}".registry (id) '
'on delete set null')
print('reclaim unreachable chunks left behind by strip')
from tqdm import tqdm
from tshistory.snapshot import Snapshot
series = tsh.list_series(e)
print('migrate series and snapshot start/end columns')
bar = tqdm(range(len(series)))
with e.begin() as cn:
for name in series:
table = tsh._serie_to_tablename(cn, name)
cn.execute(
f'alter table "{namespace}.timeserie"."{table}" '
'rename column start to tsstart'
)
cn.execute(
f'alter table "{namespace}.timeserie"."{table}" '
'rename column "end" to tsend'
)
cn.execute(
f'alter table "{namespace}.snapshot"."{table}" '
'rename column start to cstart'
)
cn.execute(
f'alter table "{namespace}.snapshot"."{table}" '
'rename column "end" to cend'
)
bar.update()
print()
print('reclaim unreachable chunks left behind by strip')
bar = tqdm(range(len(series)))
for name in series:
snap = Snapshot(e, tsh, name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment