[saem-devel] [PATCH 06 of 10] [migration] Recreate pg_trgm specific indexes if necessary

Denis Laxalde denis.laxalde at logilab.fr
Tue Jan 31 09:54:56 CET 2017


Sylvain Thenault a écrit :
> # HG changeset patch
> # User Sylvain Thénault <sylvain.thenault at logilab.fr>
> # Date 1485797437 -3600
> #      Mon Jan 30 18:30:37 2017 +0100
> # Node ID 0586614510c52d46fb043e3143b4d653590a5f14
> # Parent  34adf62121166742ee621c6048d4a5eeaaed861b
> [migration] Recreate pg_trgm specific indexes if necessary
>
> They may be erroneously dropped by cw 3.24 migration.
>
> diff --git a/cubicweb_saem_ref/migration/0.14.0_Any.py b/cubicweb_saem_ref/migration/0.14.0_Any.py
> --- a/cubicweb_saem_ref/migration/0.14.0_Any.py
> +++ b/cubicweb_saem_ref/migration/0.14.0_Any.py
> @@ -20,5 +20,13 @@ drop_cube('pyramid')
>  schema_wf = get_workflow_for('ConceptScheme')
>  with cnx.deny_all_hooks_but():
>      rql('SET X in_state S WHERE X is ConceptScheme, S eid %(s)s, NOT X in_state Y',
>          {'s': schema_wf.state_by_name('published').eid})
>  commit()
> +
> +
> +try:
> +    sql('CREATE UNIQUE INDEX words_unique_idx ON words (etype, word)')
> +    sql('CREATE INDEX words_word_idx ON words USING gin(word gin_trgm_ops)')
> +    commit(ask_confirm=False)
> +except Exception:
> +    rollback()

The try/except deserves an explanation in the commit message.



More information about the saem-devel mailing list