check if constraint is NOT there before creating
This commit is contained in:
parent
a411bda620
commit
953b8dab76
1 changed files with 4 additions and 4 deletions
|
@ -165,16 +165,16 @@ def claims_insert(
|
|||
|
||||
@event_emitter("blockchain.sync.claims.indexes", "steps")
|
||||
def claims_constraints_and_indexes(p: ProgressContext):
|
||||
is_postgres = p.ctx.is_postgres and p.ctx.pg_has_pk_constraint('claim')
|
||||
should_run = p.ctx.is_postgres and not p.ctx.pg_has_pk_constraint('claim')
|
||||
p.start(2 + len(pg_add_claim_and_tag_constraints_and_indexes))
|
||||
if is_postgres:
|
||||
if should_run:
|
||||
p.ctx.execute_notx(text("VACUUM ANALYZE claim;"))
|
||||
p.step()
|
||||
if is_postgres:
|
||||
if should_run:
|
||||
p.ctx.execute_notx(text("VACUUM ANALYZE tag;"))
|
||||
p.step()
|
||||
for constraint in pg_add_claim_and_tag_constraints_and_indexes:
|
||||
if is_postgres:
|
||||
if should_run:
|
||||
p.ctx.execute(text(constraint))
|
||||
p.step()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue