mirror of
https://git.meshkee.com/Meshkee/backend.git
synced 2026-08-11 22:30:59 +04:30
Add stable keys for special groups and SSL sync agent hooks.
English keys on store/website specials stay unique per business; domain-admin can trigger dashboard SSL sync. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
43e3912662
commit
f233665d13
@@ -0,0 +1,40 @@
|
||||
-- Stable English keys for website special groups (display title stays free-language)
|
||||
|
||||
ALTER TABLE store_specials
|
||||
ADD COLUMN IF NOT EXISTS key VARCHAR(100);
|
||||
|
||||
UPDATE store_specials
|
||||
SET key = 'special-' || id::text
|
||||
WHERE key IS NULL OR BTRIM(key) = '';
|
||||
|
||||
ALTER TABLE store_specials
|
||||
ALTER COLUMN key SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS store_specials_business_id_key_unique
|
||||
ON store_specials (business_id, key);
|
||||
|
||||
ALTER TABLE website_category_groups
|
||||
ADD COLUMN IF NOT EXISTS key VARCHAR(100);
|
||||
|
||||
UPDATE website_category_groups
|
||||
SET key = 'category-group-' || id::text
|
||||
WHERE key IS NULL OR BTRIM(key) = '';
|
||||
|
||||
ALTER TABLE website_category_groups
|
||||
ALTER COLUMN key SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS website_category_groups_business_id_key_unique
|
||||
ON website_category_groups (business_id, key);
|
||||
|
||||
ALTER TABLE website_brand_groups
|
||||
ADD COLUMN IF NOT EXISTS key VARCHAR(100);
|
||||
|
||||
UPDATE website_brand_groups
|
||||
SET key = 'brand-group-' || id::text
|
||||
WHERE key IS NULL OR BTRIM(key) = '';
|
||||
|
||||
ALTER TABLE website_brand_groups
|
||||
ALTER COLUMN key SET NOT NULL;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS website_brand_groups_business_id_key_unique
|
||||
ON website_brand_groups (business_id, key);
|
||||
Reference in New Issue
Block a user