create table blob ( blob_id integer primary key autoincrement, data blob not null, content_type text not null, created_timestamp text not null ) strict; create table shelf ( shelf_id integer primary key autoincrement, shelf_xid text not null unique, name text not null, created_timestamp text not null ) strict; create table item ( item_id integer primary key autoincrement, item_xid text not null unique, item_type text not null, name text not null, image_blob_id integer, started_timestamp text, finished_timestamp text, rating real, review text not null, other_metadata_json text, foreign key (image_blob_id) references blob(blob_id) ) strict; create table shelf_item ( shelf_item_id integer primary key, item_id integer not null, collection_id integer not null, foreign key (item_id) references item(item_id), foreign key (collection_id) references collection(collection_id), unique (item_id, collection_id) ) strict; create table shelf_arrangement ( shelf_arrangement_id integer primary key, shelf_arrangement_xid text not null unique, name text not null, collection_id integer not null, shelf_arrangement_json_blob text not null, foreign key (collection_id) references collection(collection_id) ) strict; create table activity ( activity_id integer primary key, activity_json_blob text not null ) strict;