archives: use separate table

Cleaner to separate things from the backups table.

* icon, appConfig, appStoreIcon etc are only valid for archives
* older version cloudron does not have appConfig in backups table (so it
  cannot be an archive entry)
This commit is contained in:
Girish Ramakrishnan
2024-12-10 10:06:52 +01:00
parent 2ad93c114e
commit 490840b71d
12 changed files with 261 additions and 122 deletions

View File

@@ -156,14 +156,21 @@ CREATE TABLE IF NOT EXISTS backups(
manifestJson TEXT, /* to validate if the app can be installed in this version of box */
format VARCHAR(16) DEFAULT "tgz",
preserveSecs INTEGER DEFAULT 0,
archive BOOLEAN DEFAULT 0,
appStoreIcon MEDIUMBLOB, /* only valid with archive */
icon MEDIUMBLOB, /* only valid with archive */
appConfigJson TEXT, /* only valid with archive */
INDEX creationTime_index (creationTime),
PRIMARY KEY (id));
CREATE TABLE IF NOT EXISTS archives(
id VARCHAR(128) NOT NULL UNIQUE,
backupId VARCHAR(128) NOT NULL,
creationTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
appStoreIcon MEDIUMBLOB,
icon MEDIUMBLOB,
appConfigJson TEXT,
FOREIGN KEY(backupId) REFERENCES backups(id),
PRIMARY KEY (id));
CREATE TABLE IF NOT EXISTS eventlog(
id VARCHAR(128) NOT NULL,
action VARCHAR(128) NOT NULL,