Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

New data structure #244

Merged
merged 8 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 80 additions & 74 deletions app/schemas/dev.sanmer.mrepo.database.AppDatabase/1.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "b1bfea045a8aae2b31e57dcfb1f9a45c",
"identityHash": "d6e648e0e34c262d9de5c5d59368e3d8",
"entities": [
{
"tableName": "repo",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `name` TEXT NOT NULL, `enable` INTEGER NOT NULL, `timestamp` REAL NOT NULL, `size` INTEGER NOT NULL, PRIMARY KEY(`url`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`url` TEXT NOT NULL, `disable` INTEGER NOT NULL, `size` INTEGER NOT NULL, `name` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `homepage` TEXT NOT NULL, `donate` TEXT NOT NULL, `support` TEXT NOT NULL, PRIMARY KEY(`url`))",
"fields": [
{
"fieldPath": "url",
Expand All @@ -15,78 +15,70 @@
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"fieldPath": "disable",
"columnName": "disable",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "enable",
"columnName": "enable",
"fieldPath": "size",
"columnName": "size",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "metadata.timestamp",
"columnName": "timestamp",
"affinity": "REAL",
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "metadata.size",
"columnName": "size",
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"url"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "local_updatable",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `updatable` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
},
{
"fieldPath": "id",
"columnName": "id",
"fieldPath": "metadata.homepage",
"columnName": "homepage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatable",
"columnName": "updatable",
"affinity": "INTEGER",
"fieldPath": "metadata.donate",
"columnName": "donate",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "metadata.support",
"columnName": "support",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
"url"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "online",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `repoUrl` TEXT NOT NULL, `name` TEXT NOT NULL, `version` TEXT NOT NULL, `versionCode` INTEGER NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `type` TEXT NOT NULL, `added` REAL NOT NULL, `license` TEXT NOT NULL, `homepage` TEXT NOT NULL, `source` TEXT NOT NULL, `support` TEXT NOT NULL, `donate` TEXT NOT NULL, PRIMARY KEY(`id`, `repoUrl`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`repo_url` TEXT NOT NULL, `id` TEXT NOT NULL, `name` TEXT NOT NULL, `version` TEXT NOT NULL, `version_code` INTEGER NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `license` TEXT NOT NULL, `homepage` TEXT NOT NULL, `source` TEXT NOT NULL, `donate` TEXT NOT NULL, `support` TEXT NOT NULL, PRIMARY KEY(`id`, `repo_url`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"fieldPath": "repoUrl",
"columnName": "repo_url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoUrl",
"columnName": "repoUrl",
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
Expand All @@ -104,7 +96,7 @@
},
{
"fieldPath": "versionCode",
"columnName": "versionCode",
"columnName": "version_code",
"affinity": "INTEGER",
"notNull": true
},
Expand All @@ -121,44 +113,32 @@
"notNull": true
},
{
"fieldPath": "track.type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "track.added",
"columnName": "added",
"affinity": "REAL",
"notNull": true
},
{
"fieldPath": "track.license",
"fieldPath": "metadata.license",
"columnName": "license",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "track.homepage",
"fieldPath": "metadata.homepage",
"columnName": "homepage",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "track.source",
"fieldPath": "metadata.source",
"columnName": "source",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "track.support",
"columnName": "support",
"fieldPath": "metadata.donate",
"columnName": "donate",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "track.donate",
"columnName": "donate",
"fieldPath": "metadata.support",
"columnName": "support",
"affinity": "TEXT",
"notNull": true
}
Expand All @@ -167,32 +147,32 @@
"autoGenerate": false,
"columnNames": [
"id",
"repoUrl"
"repo_url"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "version",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `repoUrl` TEXT NOT NULL, `timestamp` REAL NOT NULL, `version` TEXT NOT NULL, `versionCode` INTEGER NOT NULL, `zipUrl` TEXT NOT NULL, `changelog` TEXT NOT NULL, PRIMARY KEY(`id`, `repoUrl`, `versionCode`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`repo_url` TEXT NOT NULL, `id` TEXT NOT NULL, `timestamp` INTEGER NOT NULL, `version` TEXT NOT NULL, `version_code` INTEGER NOT NULL, `zip_url` TEXT NOT NULL, `changelog` TEXT NOT NULL, PRIMARY KEY(`id`, `repo_url`, `version_code`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"fieldPath": "repoUrl",
"columnName": "repo_url",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "repoUrl",
"columnName": "repoUrl",
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "timestamp",
"columnName": "timestamp",
"affinity": "REAL",
"affinity": "INTEGER",
"notNull": true
},
{
Expand All @@ -203,13 +183,13 @@
},
{
"fieldPath": "versionCode",
"columnName": "versionCode",
"columnName": "version_code",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "zipUrl",
"columnName": "zipUrl",
"columnName": "zip_url",
"affinity": "TEXT",
"notNull": true
},
Expand All @@ -224,16 +204,16 @@
"autoGenerate": false,
"columnNames": [
"id",
"repoUrl",
"versionCode"
"repo_url",
"version_code"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "local",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `version` TEXT NOT NULL, `versionCode` INTEGER NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `state` TEXT NOT NULL, `updateJson` TEXT NOT NULL, `lastUpdated` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `version` TEXT NOT NULL, `version_code` INTEGER NOT NULL, `author` TEXT NOT NULL, `description` TEXT NOT NULL, `state` TEXT NOT NULL, `update_json` TEXT NOT NULL, `last_updated` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
Expand All @@ -255,7 +235,7 @@
},
{
"fieldPath": "versionCode",
"columnName": "versionCode",
"columnName": "version_code",
"affinity": "INTEGER",
"notNull": true
},
Expand All @@ -279,13 +259,39 @@
},
{
"fieldPath": "updateJson",
"columnName": "updateJson",
"columnName": "update_json",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "lastUpdated",
"columnName": "lastUpdated",
"columnName": "last_updated",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"autoGenerate": false,
"columnNames": [
"id"
]
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "local_updatable",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `updatable` INTEGER NOT NULL, PRIMARY KEY(`id`))",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "updatable",
"columnName": "updatable",
"affinity": "INTEGER",
"notNull": true
}
Expand All @@ -303,7 +309,7 @@
"views": [],
"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, 'b1bfea045a8aae2b31e57dcfb1f9a45c')"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'd6e648e0e34c262d9de5c5d59368e3d8')"
]
}
}
18 changes: 6 additions & 12 deletions app/src/main/kotlin/dev/sanmer/mrepo/database/AppDatabase.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,26 @@ import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import dev.sanmer.mrepo.database.dao.JoinDao
import dev.sanmer.mrepo.database.dao.LocalDao
import dev.sanmer.mrepo.database.dao.OnlineDao
import dev.sanmer.mrepo.database.dao.RepoDao
import dev.sanmer.mrepo.database.dao.VersionDao
import dev.sanmer.mrepo.database.entity.LocalModuleEntity
import dev.sanmer.mrepo.database.entity.OnlineModuleEntity
import dev.sanmer.mrepo.database.entity.RepoEntity
import dev.sanmer.mrepo.database.entity.VersionItemEntity
import dev.sanmer.mrepo.database.entity.local.LocalModuleEntity
import dev.sanmer.mrepo.database.entity.online.OnlineModuleEntity
import dev.sanmer.mrepo.database.entity.online.RepoEntity
import dev.sanmer.mrepo.database.entity.online.VersionItemEntity

@Database(
entities = [
RepoEntity::class,
LocalModuleEntity.Updatable::class,
OnlineModuleEntity::class,
VersionItemEntity::class,
LocalModuleEntity::class
LocalModuleEntity::class,
LocalModuleEntity.Updatable::class
],
version = 1
)
abstract class AppDatabase : RoomDatabase() {
abstract fun repoDao(): RepoDao
abstract fun onlineDao(): OnlineDao
abstract fun versionDao(): VersionDao
abstract fun localDao(): LocalDao
abstract fun joinDao(): JoinDao

companion object {
fun build(context: Context) =
Expand Down
34 changes: 0 additions & 34 deletions app/src/main/kotlin/dev/sanmer/mrepo/database/dao/JoinDao.kt

This file was deleted.

Loading