From bc7dd92ed4219d35febde3c82a9ab5f48218bbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 3 Feb 2022 22:29:08 +0100 Subject: [PATCH] Use select to True on create_date If the index is created only in __register__ then it is dropped before being created again. issue11197 review389881002 --- purchase.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/purchase.py b/purchase.py index af101e482a..57cf20524d 100644 --- a/purchase.py +++ b/purchase.py @@ -239,6 +239,7 @@ class Purchase( @classmethod def __setup__(cls): super(Purchase, cls).__setup__() + cls.create_date.select = True cls._order = [ ('purchase_date', 'DESC NULLS FIRST'), ('id', 'DESC'), @@ -359,9 +360,6 @@ class Purchase( values=['processing'], where=sql_table.id.in_(sub_query.select(sub_query.id)))) - # Add index on create_date - table.index_action('create_date', action='add') - # Migration from 5.6: rename state cancel to cancelled cursor.execute(*sql_table.update( [sql_table.state], ['cancelled'],