Skip to content

Commit 45781a1

Browse files
committed
update index. add .gitignore and sample-cmd
1 parent 3abe1a0 commit 45781a1

File tree

5 files changed

+188
-2
lines changed

5 files changed

+188
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

package-lock.json

Lines changed: 164 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
},
99
"author": "Jeremy Apthorp <nornagon@nornagon.net>",
1010
"license": "MIT",
11-
"keywords": ["sharedb", "sharejs", "share", "postgres"],
11+
"keywords": [
12+
"sharedb",
13+
"sharejs",
14+
"share",
15+
"postgres"
16+
],
1217
"repository": "share/sharedb-postgres",
1318
"dependencies": {
1419
"pg": "^7.4.1",

sample-cmd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*var query = {
2+
name: "sdb-commit-op-and-snap",
3+
text: `
4+
with snaps as (
5+
insert into snapshots (collection, doc_id, doc_type, version, data)
6+
values ($1, $2, $3, $4, $5)
7+
on conflict (collection, doc_id, version) do update set doc_type = $3, data = $5
8+
returning version
9+
)
10+
insert into ops ( collection, doc_id, version, operation )
11+
values ($1, $2, $4, $6) on conflict (collection, doc_id, version) do update set operation = $6
12+
returning version
13+
`,
14+
values: [collection, id, snapshot.type, snapshot.v, snapshot.data, op]
15+
}*/
16+

structure.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ CREATE TABLE IF NOT EXISTS snapshots (
1515
PRIMARY KEY (collection, doc_id)
1616
);
1717

18-
CREATE INDEX IF NOT EXISTS ops_version ON snapshots (collection, doc_id, version);
18+
CREATE INDEX IF NOT EXISTS snapshots_version ON snapshots (collection, doc_id);
1919

2020
ALTER TABLE ops
2121
ALTER COLUMN operation

0 commit comments

Comments
 (0)