Skip to content

Commit 52b205b

Browse files
committed
chore
1 parent 917351b commit 52b205b

File tree

4 files changed

+11
-51
lines changed

4 files changed

+11
-51
lines changed

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,4 +552,5 @@ For CRDT merge to work correctly:
552552
- SQL statements:
553553
- Parameterless SQL should live as global constants in `src/<database>/database_<engine>.c` (e.g., `const char *SQL_CREATE_SETTINGS = "CREATE TABLE ...";` in `src/sqlite/database_sqlite.c`) and be used via `extern const char *SQL_CREATE_SETTINGS;` so database backends can override as needed.
554554
- Parameterized SQL must be provided via functions in the database layer (as with `database_count_pk`) so each backend can build statements appropriately.
555+
- Put backend-specific SQL templates in `src/<database>/sql_<engine>.c`; add a `database_<engine>.c` helper (exposed in `database.h`) whenever placeholder rules, quoting/escaping, or catalog-driven SQL generation differ between backends.
555556
- Preserve existing coding style and patterns (e.g., prepared statements with bind/step/reset, use `cloudsync_memory_*` macros, return SQLite error codes). Ask the user before significant structural changes or refactors.

docker/postgresql/init.sql

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,6 @@
11
-- CloudSync PostgreSQL Initialization Script
22
-- This script creates the metadata tables needed by the cloudsync extension
33

4-
/*
5-
-- -- Enable required extensions
6-
-- CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
7-
8-
-- CloudSync settings table
9-
-- Stores global configuration key-value pairs
10-
CREATE TABLE IF NOT EXISTS cloudsync_settings (
11-
key TEXT PRIMARY KEY NOT NULL,
12-
value TEXT
13-
);
14-
15-
-- CloudSync site ID table
16-
-- Stores unique site identifiers for multi-site synchronization
17-
CREATE TABLE IF NOT EXISTS cloudsync_site_id (
18-
site_id BYTEA UNIQUE NOT NULL
19-
);
20-
21-
-- CloudSync table settings
22-
-- Stores per-table and per-column configuration
23-
CREATE TABLE IF NOT EXISTS cloudsync_table_settings (
24-
tbl_name TEXT NOT NULL,
25-
col_name TEXT NOT NULL,
26-
key TEXT NOT NULL,
27-
value TEXT,
28-
PRIMARY KEY(tbl_name, key)
29-
);
30-
31-
-- CloudSync schema versions
32-
-- Tracks schema changes for migration purposes
33-
CREATE TABLE IF NOT EXISTS cloudsync_schema_versions (
34-
hash BIGINT PRIMARY KEY,
35-
seq INTEGER NOT NULL
36-
);
37-
38-
-- Create indexes for better query performance
39-
CREATE INDEX IF NOT EXISTS idx_table_settings_tbl_name
40-
ON cloudsync_table_settings(tbl_name);
41-
42-
CREATE INDEX IF NOT EXISTS idx_schema_versions_seq
43-
ON cloudsync_schema_versions(seq);
44-
*/
45-
464
-- Log initialization
475
DO $$
486
BEGIN

docker/postgresql/smoke_test.sql

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,8 @@ SELECT (length(cloudsync_uuid()) > 0) AS uuid_ok \gset
1919
-- \quit 1
2020
-- \endif
2121

22-
SELECT cloudsync_siteid();
23-
24-
SELECT (length(encode(cloudsync_siteid()::bytea, 'hex')) > 0) AS sid_ok \gset
25-
\if :sid_ok
26-
\else
27-
\quit 1
28-
\endif
22+
-- Enable debug logs
23+
SET client_min_messages = debug1; SET log_min_messages = debug1;
2924

3025
-- Enable debug logs
3126
-- SET client_min_messages = debug1; SET log_min_messages = debug1;
@@ -34,3 +29,11 @@ SELECT (length(encode(cloudsync_siteid()::bytea, 'hex')) > 0) AS sid_ok \gset
3429
DROP TABLE IF EXISTS smoke_tbl;
3530
CREATE TABLE smoke_tbl (id TEXT PRIMARY KEY, val TEXT);
3631
SELECT cloudsync_init('smoke_tbl', 'CLS', true);
32+
33+
SELECT cloudsync_siteid();
34+
35+
SELECT (length(encode(cloudsync_siteid()::bytea, 'hex')) > 0) AS sid_ok \gset
36+
\if :sid_ok
37+
\else
38+
\quit 1
39+
\endif

docker/supabase/docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
# 2. Place this in supabase/docker/ as docker-compose.override.yml
88
# 3. Run: cd supabase/docker && docker-compose up
99

10-
version: '3.8'
11-
1210
services:
1311
# Override the db service to use CloudSync-enabled PostgreSQL
1412
db:

0 commit comments

Comments
 (0)