From da5b6108c8ef7bab9e75f9dafeadf0a426335ab0 Mon Sep 17 00:00:00 2001 From: machiav3lli Date: Wed, 13 Oct 2021 13:43:56 +0200 Subject: [PATCH] Add: Room tables (1/5 in replacing SQLite with Room) --- .../com/looker/droidify/database/Tables.kt | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/main/kotlin/com/looker/droidify/database/Tables.kt diff --git a/src/main/kotlin/com/looker/droidify/database/Tables.kt b/src/main/kotlin/com/looker/droidify/database/Tables.kt new file mode 100644 index 00000000..6b1e15e1 --- /dev/null +++ b/src/main/kotlin/com/looker/droidify/database/Tables.kt @@ -0,0 +1,67 @@ +package com.looker.droidify.database + +import androidx.room.ColumnInfo +import androidx.room.Entity +import androidx.room.PrimaryKey +import com.looker.droidify.entity.Product +import com.looker.droidify.entity.ProductItem +import com.looker.droidify.entity.Repository + +@Entity +class Repository { + @PrimaryKey(autoGenerate = true) + @ColumnInfo(name = "_id") + var id: Long = 0 + + var enabled = 0 + var deleted = 0 + + @ColumnInfo(typeAffinity = ColumnInfo.BLOB) + var data: Repository? = null +} + +@Entity(primaryKeys = ["repository_id", "package_name"]) +class Product { + var repository_id: Long = 0 + var package_name = "" + + var name = "" + var summary = "" + var description = "" + var added = 0 + var updated = 0 + var version_code = 0 + var signatures = "" + var compatible = 0 + + @ColumnInfo(typeAffinity = ColumnInfo.BLOB) + var data: Product? = null + + @ColumnInfo(typeAffinity = ColumnInfo.BLOB) + var data_item: ProductItem? = null +} + +@Entity(primaryKeys = ["repository_id", "package_name", "name"]) +class Category { + var repository_id: Long = 0 + var package_name = "" + var name = "" +} + +@Entity +class Installed { + @PrimaryKey + var package_name = "" + + var version = "" + var version_code = 0 + var signatures = "" +} + +@Entity +class Lock { + @PrimaryKey + var package_name = "" + + var version_code = 0 +} \ No newline at end of file