Skip to content

Commit

Permalink
local changes are now identified by site_id matching local site_id
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Dec 1, 2023
1 parent 6f0ccac commit 57f1a8f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/direct-connect-browser/src/common/DB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default async function getDB(wasmUri: string | undefined, dbid: DBID) {
const [pullChangesetStmt, applyChangesetStmt, updatePeerTrackerStmt] =
await Promise.all([
db.prepare(
`SELECT "table", "pk", "cid", "val", "col_version", "db_version", "cl", "seq" FROM crsql_changes WHERE db_version > ? AND site_id IS NULL`
`SELECT "table", "pk", "cid", "val", "col_version", "db_version", "cl", "seq" FROM crsql_changes WHERE db_version > ? AND site_id = crsql_site_id()`
),
db.prepare(
`INSERT INTO crsql_changes ("table", "pk", "cid", "val", "col_version", "db_version", "site_id", "cl", "seq") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
Expand Down
3 changes: 1 addition & 2 deletions packages/direct-connect-nodejs/src/private/DB.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import SQLiteDB from "better-sqlite3";
import type { Database } from "better-sqlite3";
import { Config } from "../Types.js";
import { Change, bytesToHex } from "@vlcn.io/direct-connect-common";
import { Change } from "@vlcn.io/direct-connect-common";
import { extensionPath } from "@vlcn.io/crsqlite";
import util from "./util.js";
import touchHack from "./touchHack.js";
import { SchemaRow } from "./ServiceDB.js";
import logger from "../logger.js";

/**
* Wraps a normal better-sqlite3 connection to provide
Expand Down
1 change: 1 addition & 0 deletions scripts/pkgs.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ declare -a pkgs=(
"@vlcn.io/ws-browserdb"
"@vlcn.io/typed-sql"
"@vlcn.io/typed-sql-cli"
"@vlcn.io/id"
)

# two packages have directory names mismatched with package names hence this array.
Expand Down

0 comments on commit 57f1a8f

Please sign in to comment.