@fonderie/customers 6.1.6 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ -- Workspace-scope customer labels. The table is a SHARED vocabulary: an
2
+ -- unconditional list exposed every tenant's custom label values, and delete
3
+ -- was global (harm-reduced earlier to unreferenced-only). Add an optional
4
+ -- workspace_id: NULL = a shared/system default (the seeded rows keep NULL),
5
+ -- non-null = a label private to one workspace.
6
+ ALTER TABLE fonderie_customer_labels ADD COLUMN IF NOT EXISTS workspace_id UUID;
7
+
8
+ -- The old global UNIQUE(type,value) blocked two workspaces from having the
9
+ -- same custom (type,value). Replace it with two partial unique indexes:
10
+ -- shared defaults are unique per (type,value); workspace labels are unique
11
+ -- per (type,value,workspace_id).
12
+ ALTER TABLE fonderie_customer_labels DROP CONSTRAINT IF EXISTS uq_fcl_type_value;
13
+
14
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_fcl_shared
15
+ ON fonderie_customer_labels (type, value)
16
+ WHERE workspace_id IS NULL;
17
+
18
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_fcl_scoped
19
+ ON fonderie_customer_labels (type, value, workspace_id)
20
+ WHERE workspace_id IS NOT NULL;
21
+
22
+ CREATE INDEX IF NOT EXISTS idx_fcl_workspace ON fonderie_customer_labels (workspace_id);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fonderie/customers",
3
- "version": "6.1.6",
3
+ "version": "6.2.0",
4
4
  "description": "Workspace-scoped customer records — individuals and businesses with multiple emails, phones, addresses, notes, and tags.",
5
5
  "keywords": [
6
6
  "fonderiejs",