File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
- CREATE TABLE ops (
1
+ CREATE TABLE IF NOT EXISTS ops (
2
2
collection character varying (255 ) not null ,
3
3
doc_id character varying (255 ) not null ,
4
4
version integer not null ,
5
5
operation jsonb not null , -- {v:0, create:{...}} or {v:n, op:[...]}
6
6
PRIMARY KEY (collection, doc_id, version)
7
7
);
8
8
9
- CREATE TABLE snapshots (
9
+ CREATE TABLE IF NOT EXISTS snapshots (
10
10
collection character varying (255 ) not null ,
11
11
doc_id character varying (255 ) not null ,
12
12
doc_type character varying (255 ) not null ,
13
13
version integer not null ,
14
14
data jsonb not null ,
15
15
PRIMARY KEY (collection, doc_id)
16
16
);
17
+
18
+ CREATE INDEX IF NOT EXISTS ops_version ON snapshots (collection, doc_id, version);
19
+
20
+ ALTER TABLE ops
21
+ ALTER COLUMN operation
22
+ SET DATA TYPE jsonb
23
+ USING operation::jsonb;
24
+
25
+ ALTER TABLE snapshots
26
+ ALTER COLUMN data
27
+ SET DATA TYPE jsonb
28
+ USING data::jsonb;
You can’t perform that action at this time.
0 commit comments