Cayley v0.7.0 is still able to read and write databases of these types in old format. It can be accessed by changing backend name from bolt/leveldb/mongo to bolt1/leveldb1/mongo1. Thus, you can use guide for moving data between different backends for v0.7.x (see below).
Note: support for old versions will be dropped starting from v0.7.1.
SQL
Data format for SQL between v0.6.1 and v0.7.x has not changed significantly. Database can be upgraded by executing the following SQL statements:
1
ALTERTABLE quads DROP id;
2
ALTERTABLE nodes ADD refs INTDEFAULT0NOTNULL;
3
ALTERTABLE nodes ALTERCOLUMN refs DROPDEFAULT;
4
UPDATE nodes SET refs =
5
(SELECTcount(1)FROM quads WHERE subject_hash = nodes.hash)+
6
(SELECTcount(1)FROM quads WHERE predicate_hash = nodes.hash)+
7
(SELECTcount(1)FROM quads WHERE object_hash = nodes.hash)+
8
(SELECTcount(1)FROM quads WHERE label_hash = nodes.hash);
Copied!
From different backend (Cayley 0.7+)
First you need to dump all the data from old backend (pq extension is important):
1
./cayley dump -d <backend> -a <address> -o ./data.pq.gz
Copied!
or using config file:
1
./cayley dump -c <config> -o ./data.pq.gz
Copied!
And load the data into a new backend and/or database:
1
./cayley load --init -d <new-backend> -a <new-address> -i ./data.pq.gz