Make Shopify identifier unique per record and web shop

Closes #14266
This commit is contained in:
Cédric Krier committed 2025-09-30 15:55:59 +02:00
1 parent f18165b5fc
commit 0f331ef1fe
1 file changed
+9 -2
+9 -2
View File
@@ -653,14 +653,21 @@ class ShopShopifyIdentifier(IdentifierMixin, ModelSQL, ModelView):
}
t = cls.__table__()
cls._sql_constraints += [
('record_web_shop_unique',
Unique(t, t.record, t.shopify_identifier_signed),
('web_shop_record_unique',
Unique(t, t.record, t.web_shop),
'web_shop_shopify.msg_identifier_record_web_shop_unique'),
]
cls._buttons.update({
'set_to_update': {},
})
@classmethod
def __register__(cls, module):
table_h = cls.__table_handler__(module)
super().__register__(module)
# Migration from 7.6: replace record_web_shop_unique
table_h.drop_constraint('record_web_shop_unique')
@classmethod
def get_records(cls):
pool = Pool()