@selvajs/supabase-provider 0.13.5-beta.1 → 0.13.5-beta.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/supabase-provider",
3
- "version": "0.13.5-beta.1",
3
+ "version": "0.13.5-beta.2",
4
4
  "description": "Supabase (Auth + Postgres + Storage) implementations of @selvajs/platform interfaces",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -0,0 +1,25 @@
1
+ -- Make project (org_id, slug) and (org_id, lower(name)) uniqueness ignore
2
+ -- tombstones.
3
+ --
4
+ -- The initial migration declared `unique (org_id, slug)` and
5
+ -- `projects_org_name_unique` as UNCONDITIONAL uniqueness guards. Every read in
6
+ -- SupabaseProjectStore filters `deleted_at is null`, so a soft-deleted project
7
+ -- is invisible to the store yet still occupies its (org_id, slug) and
8
+ -- (org_id, lower(name)) pairs. That makes a deleted slug/name permanently
9
+ -- unrecoverable through the store API: createProject hits 23505, getBySlug
10
+ -- returns null, updateProject can't match the tombstone.
11
+ --
12
+ -- Every other uniqueness guard in this schema (idx_orgs_live, idx_projects_org,
13
+ -- the project_members index) is already partial `where deleted_at is null`.
14
+ -- These two were the inconsistency. Swap them to partial so tombstones release
15
+ -- the slug/name and create-after-delete just works.
16
+
17
+ -- (org_id, slug)
18
+ alter table selva.projects drop constraint if exists projects_org_id_slug_key;
19
+ create unique index if not exists projects_org_slug_live
20
+ on selva.projects (org_id, slug) where deleted_at is null;
21
+
22
+ -- (org_id, lower(name)) — same latent bug
23
+ drop index if exists selva.projects_org_name_unique;
24
+ create unique index if not exists projects_org_name_live
25
+ on selva.projects (org_id, lower(name)) where deleted_at is null;