Skip to content

Commit ef4d46b

Browse files
committed
test: minor fixes
1 parent 8ab8a94 commit ef4d46b

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.claude/commands/test-sync-roundtrip.md

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Execute a full roundtrip sync test between a local SQLite database and the local
1111

1212
### Step 1: Get DDL from User
1313

14-
Ask the user to provide a DDL query for the table to test. It can be in PostgreSQL or SQLite format. Example:
14+
Ask the user to provide a DDL query for the table(s) to test. It can be in PostgreSQL or SQLite format. Offer the following options:
15+
16+
**Option 1: Simple TEXT primary key**
1517
```sql
1618
CREATE TABLE test_sync (
1719
id TEXT PRIMARY KEY NOT NULL,
@@ -20,6 +22,33 @@ CREATE TABLE test_sync (
2022
);
2123
```
2224

25+
**Option 2: UUID primary key**
26+
```sql
27+
CREATE TABLE test_uuid (
28+
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
29+
name TEXT,
30+
created_at TIMESTAMPTZ DEFAULT NOW()
31+
);
32+
```
33+
34+
**Option 3: Two tables scenario (tests multi-table sync)**
35+
```sql
36+
CREATE TABLE authors (
37+
id TEXT PRIMARY KEY NOT NULL,
38+
name TEXT,
39+
email TEXT
40+
);
41+
42+
CREATE TABLE books (
43+
id TEXT PRIMARY KEY NOT NULL,
44+
title TEXT,
45+
author_id TEXT,
46+
published_year INTEGER
47+
);
48+
```
49+
50+
**Note:** Avoid INTEGER PRIMARY KEY for sync tests as it is not recommended for distributed sync scenarios (conflicts with auto-increment across devices).
51+
2352
### Step 2: Convert DDL
2453

2554
Convert the provided DDL to both SQLite and PostgreSQL compatible formats if needed. Key differences:
@@ -32,7 +61,7 @@ Convert the provided DDL to both SQLite and PostgreSQL compatible formats if nee
3261

3362
Run the token script from the cloudsync project:
3463
```bash
35-
cd ../cloudsync && go run scripts/get_supabase_token.go -project-ref=supabase-local -email=andrea@sqlitecloud.io -password="password" -apikey=sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz -auth-url=http://127.0.0.1:54321
64+
cd ../cloudsync && go run scripts/get_supabase_token.go -project-ref=supabase-local -email=claude@sqlitecloud.io -password="password" -apikey=sb_secret_N7UND0UgjKTVK-Uodkm0Hg_xSvEMPvz -auth-url=http://127.0.0.1:54321
3665
```
3766
Save the JWT token for later use.
3867

docker/Makefile.postgresql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ postgres-supabase-run-test:
288288
# Run smoke test against Docker standalone database
289289
postgres-docker-run-test:
290290
@echo "Running Docker test..."
291-
@PGPASSWORD="$(PG_DOCKER_DB_PASSWORD)" psql postgresql://$(PG_DOCKER_DB_USER)@$(PG_DOCKER_DB_HOST):$(PG_DOCKER_DB_PORT)/$(PG_DOCKER_DB_NAME) -f docker/postgresql/full_test.sql
291+
@PGPASSWORD="$(PG_DOCKER_DB_PASSWORD)" psql postgresql://$(PG_DOCKER_DB_USER)@$(PG_DOCKER_DB_HOST):$(PG_DOCKER_DB_PORT)/$(PG_DOCKER_DB_NAME) -f test/postgresql/full_test.sql
292292
@echo "Test completed."
293293

294294
# ============================================================================

0 commit comments

Comments
 (0)