BEGIN TRANSACTION;
CREATE TABLE bookmarks (id INTEGER primary key AUTOINCREMENT, idparent INTEGER, title VARCHAR(255), description TEXT, fileType CHAR(50), dirPath TEXT, created INTEGER, modified INTEGER,FOREIGN KEY(idparent) REFERENCES bookmarks_folders(id) ON DELETE CASCADE ON UPDATE CASCADE );
CREATE TABLE bookmarksToolbar (id INTEGER primary key AUTOINCREMENT, idparent INTEGER, title VARCHAR(255), created INTEGER,FOREIGN KEY(idparent) REFERENCES bookmarksToolbar_folders(id) ON DELETE CASCADE ON UPDATE CASCADE);
CREATE TABLE bookmarksToolbar_folders (id INTEGER primary key AUTOINCREMENT, name VARCHAR(255), created INTEGER);
CREATE TABLE bookmarks_content (id INTEGER primary key AUTOINCREMENT, refId INTEGER, latexContent TEXT, created INTEGER,FOREIGN KEY(refId) REFERENCES bookmarks(id) ON DELETE CASCADE ON UPDATE CASCADE );
CREATE TABLE bookmarks_folders (id INTEGER primary key AUTOINCREMENT, idparent INTEGER, name VARCHAR(255), description VARCHAR(255), dirPath TEXT, created INTEGER, modified INTEGER,FOREIGN KEY(idparent) REFERENCES bookmarks_folders(id) ON DELETE CASCADE ON UPDATE CASCADE);
CREATE TABLE equalx (id INTEGER primary key, version VARCHAR(10), created INTEGER, modified INTEGER);
CREATE TABLE history (id INTEGER primary key AUTOINCREMENT, title VARCHAR(255), created INTEGER);
INSERT INTO bookmarks_folders VALUES(1,NULL,'ROOT','',NULL,NULL,NULL);
COMMIT;
