mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:59:18 +01:00
Fix #11
This commit is contained in:
parent
f9a97631f2
commit
c830c037f7
@ -14,7 +14,7 @@ import eu.kanade.mangafeed.data.database.tables.MangaTable;
|
|||||||
public class DbOpenHelper extends SQLiteOpenHelper {
|
public class DbOpenHelper extends SQLiteOpenHelper {
|
||||||
|
|
||||||
public static final String DATABASE_NAME = "mangafeed.db";
|
public static final String DATABASE_NAME = "mangafeed.db";
|
||||||
public static final int DATABASE_VERSION = 1;
|
public static final int DATABASE_VERSION = 2;
|
||||||
|
|
||||||
public DbOpenHelper(@NonNull Context context) {
|
public DbOpenHelper(@NonNull Context context) {
|
||||||
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
super(context, DATABASE_NAME, null, DATABASE_VERSION);
|
||||||
@ -36,7 +36,12 @@ public class DbOpenHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
|
public void onUpgrade(@NonNull SQLiteDatabase db, int oldVersion, int newVersion) {
|
||||||
|
if (oldVersion == 1) {
|
||||||
|
db.execSQL("ALTER TABLE manga_sync RENAME TO tmp;");
|
||||||
|
db.execSQL(MangaSyncTable.getCreateTableQuery());
|
||||||
|
db.execSQL("INSERT INTO " + MangaSyncTable.TABLE + " SELECT * FROM tmp;");
|
||||||
|
db.execSQL("DROP TABLE tmp;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,6 +36,7 @@ public class MangaSyncTable {
|
|||||||
+ COLUMN_TOTAL_CHAPTERS + " INTEGER NOT NULL, "
|
+ COLUMN_TOTAL_CHAPTERS + " INTEGER NOT NULL, "
|
||||||
+ COLUMN_STATUS + " INTEGER NOT NULL, "
|
+ COLUMN_STATUS + " INTEGER NOT NULL, "
|
||||||
+ COLUMN_SCORE + " FLOAT NOT NULL, "
|
+ COLUMN_SCORE + " FLOAT NOT NULL, "
|
||||||
|
+ "UNIQUE (" + COLUMN_MANGA_ID + ", " + COLUMN_SYNC_ID + ") ON CONFLICT REPLACE, "
|
||||||
+ "FOREIGN KEY(" + COLUMN_MANGA_ID + ") REFERENCES " + MangaTable.TABLE + "(" + MangaTable.COLUMN_ID + ") "
|
+ "FOREIGN KEY(" + COLUMN_MANGA_ID + ") REFERENCES " + MangaTable.TABLE + "(" + MangaTable.COLUMN_ID + ") "
|
||||||
+ "ON DELETE CASCADE"
|
+ "ON DELETE CASCADE"
|
||||||
+ ");";
|
+ ");";
|
||||||
|
Loading…
Reference in New Issue
Block a user