diff --git a/app/schemas/com.m57.hermescontrol.data.local.HermesDatabase/1.json b/app/schemas/com.m57.hermescontrol.data.local.HermesDatabase/1.json new file mode 100644 index 00000000..add2c95f --- /dev/null +++ b/app/schemas/com.m57.hermescontrol.data.local.HermesDatabase/1.json @@ -0,0 +1,71 @@ +{ + "formatVersion": 1, + "database": { + "version": 1, + "identityHash": "80650cb2405e04876925851f326bda5c", + "entities": [ + { + "tableName": "chat_messages", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `session_id` TEXT NOT NULL, `role` TEXT NOT NULL, `content` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `tool_name` TEXT, `tool_status` TEXT, `is_streaming` INTEGER NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "sessionId", + "columnName": "session_id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "role", + "columnName": "role", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "content", + "columnName": "content", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "timestamp", + "columnName": "timestamp", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "toolName", + "columnName": "tool_name", + "affinity": "TEXT" + }, + { + "fieldPath": "toolStatus", + "columnName": "tool_status", + "affinity": "TEXT" + }, + { + "fieldPath": "isStreaming", + "columnName": "is_streaming", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + } + } + ], + "setupQueries": [ + "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, '80650cb2405e04876925851f326bda5c')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/com/m57/hermescontrol/data/local/HermesDatabase.kt b/app/src/main/java/com/m57/hermescontrol/data/local/HermesDatabase.kt index d3f56e04..fc8b3f4a 100644 --- a/app/src/main/java/com/m57/hermescontrol/data/local/HermesDatabase.kt +++ b/app/src/main/java/com/m57/hermescontrol/data/local/HermesDatabase.kt @@ -4,11 +4,12 @@ import android.content.Context import androidx.room.Database import androidx.room.Room import androidx.room.RoomDatabase +import com.m57.hermescontrol.BuildConfig @Database( entities = [ChatMessageEntity::class], version = 1, - exportSchema = false, + exportSchema = true, ) abstract class HermesDatabase : RoomDatabase() { abstract fun chatMessageDao(): ChatMessageDao @@ -24,7 +25,11 @@ abstract class HermesDatabase : RoomDatabase() { context.applicationContext, HermesDatabase::class.java, "hermes_control.db", - ).fallbackToDestructiveMigration(false) + ).apply { + if (BuildConfig.DEBUG) { + fallbackToDestructiveMigration(false) + } + } .build() .also { instance = it } }