Skip to content

Commit 17abb1d

Browse files
committed
docs(docs/postgresql/CLIENT.md): clarify primary key requirements for PostgreSQL and SQLite, added support for UUID primary keys
1 parent cf761ec commit 17abb1d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/postgresql/CLIENT.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ so CloudSync can sync between a PostgreSQL server and SQLite clients.
3535

3636
### 1) Primary Keys
3737

38-
- Use **TEXT NOT NULL** primary keys only (UUIDs as text).
38+
- Use **TEXT NOT NULL** primary keys in SQLite.
39+
- PostgreSQL primary keys can be **TEXT NOT NULL** or **UUID**. If the PK type
40+
isn't explicitly mapped to a DBTYPE (like UUID), it will be converted to TEXT
41+
in the payload so it remains compatible with the SQLite extension.
3942
- Generate IDs with `cloudsync_uuid()` on both sides.
4043
- Avoid INTEGER auto-increment PKs.
4144

@@ -49,6 +52,11 @@ PostgreSQL:
4952
id TEXT PRIMARY KEY NOT NULL
5053
```
5154

55+
PostgreSQL (UUID):
56+
```sql
57+
id UUID PRIMARY KEY NOT NULL
58+
```
59+
5260
### 2) NOT NULL Columns Must Have DEFAULTs
5361

5462
CloudSync merges column-by-column. Any NOT NULL (non-PK) column needs a DEFAULT

0 commit comments

Comments
 (0)