@oktis-works/cms 0.10.5 → 0.10.6

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.
@@ -12,9 +12,17 @@ WHERE a.ctid <> (
12
12
  AND b.slug = a.slug
13
13
  );
14
14
 
15
- -- Add unique constraint
16
- ALTER TABLE content
17
- ADD CONSTRAINT uq_content_tenant_type_slug UNIQUE (tenant_id, type, slug);
15
+ -- Add unique constraint (safe: checks if exists first)
16
+ DO $$
17
+ BEGIN
18
+ IF NOT EXISTS (
19
+ SELECT 1 FROM pg_constraint
20
+ WHERE conname = 'uq_content_tenant_type_slug'
21
+ ) THEN
22
+ ALTER TABLE content
23
+ ADD CONSTRAINT uq_content_tenant_type_slug UNIQUE (tenant_id, type, slug);
24
+ END IF;
25
+ END $$;
18
26
 
19
27
  -- +migrate Down
20
28
  ALTER TABLE content DROP CONSTRAINT IF EXISTS uq_content_tenant_type_slug;
@@ -0,0 +1,19 @@
1
+ -- +migrate Up
2
+ -- Add unique constraint for menus (tenant_id, slug) to support ON CONFLICT in seed
3
+ -- This is required for the demo content seed to work with ON CONFLICT specification
4
+
5
+ -- First, remove any duplicate entries that would violate the unique constraint
6
+ DELETE FROM menus a
7
+ WHERE a.ctid <> (
8
+ SELECT min(b.ctid)
9
+ FROM menus b
10
+ WHERE b.tenant_id = a.tenant_id
11
+ AND b.slug = a.slug
12
+ );
13
+
14
+ -- Add unique constraint
15
+ ALTER TABLE menus
16
+ ADD CONSTRAINT uq_menus_tenant_slug UNIQUE (tenant_id, slug);
17
+
18
+ -- +migrate Down
19
+ ALTER TABLE menus DROP CONSTRAINT IF EXISTS uq_menus_tenant_slug;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oktis-works/cms",
3
- "version": "0.10.5",
3
+ "version": "0.10.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -20,10 +20,10 @@
20
20
  "clean": "rm -rf dist migrations tsconfig.tsbuildinfo"
21
21
  },
22
22
  "dependencies": {
23
- "@oktis-works/auth": "^0.7.5",
23
+ "@oktis-works/auth": "^0.7.6",
24
24
  "@oktis-works/config": "^0.6.4",
25
- "@oktis-works/core": "^0.10.2",
26
- "@oktis-works/database": "^0.10.2",
25
+ "@oktis-works/core": "^0.10.3",
26
+ "@oktis-works/database": "^0.11.0",
27
27
  "@oktis-works/validation": "^0.7.0",
28
28
  "@oktis-works/theme-runtime": "^0.7.0"
29
29
  },