mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 10:19:33 +02:00
end position in bookmarks: db side
This commit is contained in:
parent
afc8ac54ee
commit
7f5257d2fc
1 changed files with 21 additions and 1 deletions
|
@ -77,7 +77,7 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
|
||||
private void migrate() {
|
||||
final int version = myDatabase.getVersion();
|
||||
final int currentVersion = 22;
|
||||
final int currentVersion = 24;
|
||||
if (version >= currentVersion) {
|
||||
return;
|
||||
}
|
||||
|
@ -129,6 +129,10 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
updateTables20();
|
||||
case 21:
|
||||
updateTables21();
|
||||
case 22:
|
||||
updateTables22();
|
||||
case 23:
|
||||
updateTables23();
|
||||
}
|
||||
myDatabase.setTransactionSuccessful();
|
||||
myDatabase.setVersion(currentVersion);
|
||||
|
@ -1363,4 +1367,20 @@ final class SQLiteBooksDatabase extends BooksDatabase {
|
|||
"uid TEXT NOT NULL," +
|
||||
"CONSTRAINT BookUid_Unique UNIQUE (book_id,type,uid))");
|
||||
}
|
||||
|
||||
private void updateTables22() {
|
||||
myDatabase.execSQL("ALTER TABLE Bookmarks ADD COLUMN end_paragraph INTEGER");
|
||||
myDatabase.execSQL("ALTER TABLE Bookmarks ADD COLUMN end_word INTEGER");
|
||||
myDatabase.execSQL("ALTER TABLE Bookmarks ADD COLUMN end_character INTEGER");
|
||||
}
|
||||
|
||||
private void updateTables23() {
|
||||
myDatabase.execSQL(
|
||||
"CREATE TABLE IF NOT EXISTS HighlightingStyle(" +
|
||||
"style_id INTEGER PRIMARY KEY," +
|
||||
"bg_color INTEGER NOT NULL)");
|
||||
myDatabase.execSQL("INSERT INTO HighlightingStyle (style_id, bg_color) VALUES (1, 127*256*256 + 127*256 + 127)");
|
||||
myDatabase.execSQL("ALTER TABLE Bookmarks ADD COLUMN style_id INTEGER NOT NULL REFERENCES HighlightingStyle(style_id) DEFAULT 1");
|
||||
myDatabase.execSQL("UPDATE Bookmarks SET end_paragraph = LENGTH(bookmark_text)");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue