Skip to content

Commit 6b98e25

Browse files
hotfix: fix database issues
1 parent ec0cfe5 commit 6b98e25

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

app/src/main/kotlin/io/github/landwarderer/futon/core/db/MangaDatabase.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import io.github.landwarderer.futon.core.db.migrations.Migration24To23
4141
import io.github.landwarderer.futon.core.db.migrations.Migration24To25
4242
import io.github.landwarderer.futon.core.db.migrations.Migration25To26
4343
import io.github.landwarderer.futon.core.db.migrations.Migration26To27
44+
import io.github.landwarderer.futon.core.db.migrations.Migration27To28
4445
import io.github.landwarderer.futon.core.db.migrations.Migration2To3
4546
import io.github.landwarderer.futon.core.db.migrations.Migration3To4
4647
import io.github.landwarderer.futon.core.db.migrations.Migration4To5
@@ -72,7 +73,7 @@ import kotlinx.coroutines.Dispatchers
7273
import kotlinx.coroutines.isActive
7374
import kotlinx.coroutines.launch
7475

75-
const val DATABASE_VERSION = 27
76+
const val DATABASE_VERSION = 28
7677

7778
@Database(
7879
entities = [
@@ -146,6 +147,7 @@ fun getDatabaseMigrations(context: Context): Array<Migration> = arrayOf(
146147
Migration24To25(),
147148
Migration25To26(),
148149
Migration26To27(),
150+
Migration27To28(),
149151
)
150152

151153
fun MangaDatabase(context: Context): MangaDatabase = Room
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package io.github.landwarderer.futon.core.db.migrations
2+
3+
import androidx.room.migration.Migration
4+
import androidx.sqlite.db.SupportSQLiteDatabase
5+
6+
class Migration27To28 : Migration(27, 28) {
7+
8+
override fun migrate(db: SupportSQLiteDatabase) {
9+
db.execSQL(
10+
"""
11+
CREATE TABLE IF NOT EXISTS external_extension_repos (
12+
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
13+
type TEXT NOT NULL,
14+
baseUrl TEXT NOT NULL,
15+
name TEXT NOT NULL,
16+
shortName TEXT,
17+
website TEXT NOT NULL,
18+
signingKeyFingerprint TEXT NOT NULL,
19+
createdAt INTEGER NOT NULL,
20+
updatedAt INTEGER NOT NULL,
21+
lastSuccessAt INTEGER NOT NULL,
22+
lastError TEXT,
23+
version TEXT
24+
)
25+
""".trimIndent()
26+
)
27+
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_external_extension_repos_type_baseUrl` ON `external_extension_repos` (`type`, `baseUrl`)")
28+
db.execSQL("CREATE UNIQUE INDEX IF NOT EXISTS `index_external_extension_repos_type_signingKeyFingerprint` ON `external_extension_repos` (`type`, `signingKeyFingerprint`)")
29+
}
30+
}

0 commit comments

Comments
 (0)