private SavedSearchTable searchTable;
private WatchFolderTable watchFolderTable;
private InvalidXMLTable invalidXMLTable;
+ private LinkedNotebookTable linkedNotebookTable;
+ private SharedNotebookTable sharedNotebookTable;
private SyncTable syncTable;
private final ApplicationLogger logger;
private Connection conn;
invalidXMLTable = new InvalidXMLTable(logger, this);
wordsTable = new WordsTable(logger, this);
syncTable = new SyncTable(logger, this);
+ linkedNotebookTable = new LinkedNotebookTable(logger, this);
+ sharedNotebookTable = new SharedNotebookTable(logger, this);
}
QJdbc.initialize();
+ setupTables();
+
File f = Global.getFileManager().getDbDirFile(Global.databaseName + ".h2.db");
boolean dbExists = f.exists();
- // If it doesn't exist and we are the main thread, then we need to create stuff.
- if (!dbExists) {
- createTables();
- Global.setAutomaticLogin(false);
- }
- setupTables();
-
logger.log(logger.HIGH, "Entering RDatabaseConnection.dbSetup");
return;
}
- logger.log(logger.HIGH, "Leaving RDatabaseConnection.dbSetup");
-
-
+ // If it doesn't exist and we are the main thread, then we need to create stuff.
+ if (!dbExists) {
+ createTables();
+ Global.setAutomaticLogin(false);
+ }
logger.log(logger.HIGH, "Leaving DatabaseConnection.dbSetup" +id);
}
version = "0.86";
Global.setDatabaseVersion(version);
}
+ if (version.equals("0.86")) {
+
+ executeSql("alter table notebook add column publishingUri VarChar");
+ executeSql("alter table notebook add column publishingOrder Integer");
+ executeSql("alter table notebook add column publishingAscending VarChar");
+ executeSql("alter table notebook add column publishingPublicDescription varchar");
+ executeSql("alter table notebook add column stack varchar");
+ executeSql("alter table notebook add column icon blob");
+ executeSql("alter table tag add column icon blob");
+ executeSql("alter table SavedSearch add column icon blob");
+
+ executeSql("create index NOTE_THUMBNAIL_INDEX on note (thumbnailneeded, guid);");
+ executeSql("create index NOTE_EXPUNGED_INDEX on note (isExpunged, guid);");
+ executeSql("create index NOTE_DUEDATE_INDEX on note (attributeSubjectDate, guid);");
+ executeSql("create index RESOURCES_GUID_INDEX on noteresources (noteGuid, guid);");
+ executeSql("update note set thumbnailneeded=true, thumbnail=null;");
+ executeSql("update notebook set publishingUri='', " +
+ "publishingAscending='', stack='', publishingOrder=1, " +
+ "publishingPublicDescription=''");
+
+ sharedNotebookTable.createTable();
+ linkedNotebookTable.createTable();
+
+ version = "0.95";
+ executeSql("Insert into Sync (key, value) values ('FullLinkedNotebookSync', 'true')");
+ executeSql("Insert into Sync (key, value) values ('FullSharedNotebookSync', 'true')");
+ Global.setDatabaseVersion(version);
+ }
}
public void executeSql(String sql) {
if (!Global.getDatabaseVersion().equals("0.86")) {
upgradeDb(Global.getDatabaseVersion());
}
+ if (!Global.getDatabaseVersion().equals("0.95")) {
+ upgradeDb(Global.getDatabaseVersion());
+ }
}
watchFolderTable.createTable();
invalidXMLTable.createTable();
wordsTable.createTable();
- syncTable.createTable();
-
+ syncTable.createTable();
}
public Connection getConnection() {
public SyncTable getSyncTable() {
return syncTable;
}
+ public LinkedNotebookTable getLinkedNotebookTable() {
+ return linkedNotebookTable;
+ }
+ public SharedNotebookTable getSharedNotebookTable() {
+ return sharedNotebookTable;
+ }
}