Содержание

SQLite

Merge two databases

First method

attach 'second.db' as toMerge;           
BEGIN; 
insert into AuditRecords select * from toMerge.AuditRecords; 
COMMIT; 
detach toMerge;

Second method

$sqlite3 database1.db '.dump' >> tmp
$sqlite3 database2.db '.dump' >> tmp

$sqlite3 database3.db '.import tmp table1'
...
$sqlite3 database3.db '.import tmp tableX'

$ #sometimes sqlite3 database3.db < 'tmp' instead of last row