This commit is contained in:
kunfei 2023-02-19 19:59:54 +08:00
parent 5b1e4b6bf6
commit ad3a1eec4d
3 changed files with 15 additions and 5 deletions

View File

@ -2,7 +2,7 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 60, "version": 60,
"identityHash": "a1c0854a62819a02546c82a1d60ac1b8", "identityHash": "19e1f66252eb41afc0990f202fe4527a",
"entities": [ "entities": [
{ {
"tableName": "books", "tableName": "books",
@ -1689,7 +1689,7 @@
}, },
{ {
"tableName": "dictRules", "tableName": "dictRules",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `urlRule` TEXT NOT NULL, `showRule` TEXT NOT NULL, PRIMARY KEY(`name`))", "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`name` TEXT NOT NULL, `urlRule` TEXT NOT NULL, `showRule` TEXT NOT NULL, `enabled` INTEGER NOT NULL, PRIMARY KEY(`name`))",
"fields": [ "fields": [
{ {
"fieldPath": "name", "fieldPath": "name",
@ -1708,6 +1708,12 @@
"columnName": "showRule", "columnName": "showRule",
"affinity": "TEXT", "affinity": "TEXT",
"notNull": true "notNull": true
},
{
"fieldPath": "enabled",
"columnName": "enabled",
"affinity": "INTEGER",
"notNull": true
} }
], ],
"primaryKey": { "primaryKey": {
@ -1766,7 +1772,7 @@
"views": [], "views": [],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a1c0854a62819a02546c82a1d60ac1b8')" "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '19e1f66252eb41afc0990f202fe4527a')"
] ]
} }
} }

View File

@ -12,6 +12,9 @@ interface DictRuleDao {
@get:Query("select * from dictRules") @get:Query("select * from dictRules")
val all: List<DictRule> val all: List<DictRule>
@get:Query("select * from dictRules where enabled = 1")
val enabled: List<DictRule>
@Upsert @Upsert
fun upsert(vararg dictRule: DictRule) fun upsert(vararg dictRule: DictRule)

View File

@ -10,6 +10,7 @@ import androidx.room.PrimaryKey
data class DictRule( data class DictRule(
@PrimaryKey @PrimaryKey
val name: String, val name: String,
val urlRule: String, var urlRule: String,
val showRule: String var showRule: String,
var enabled: Boolean
) )