Fixing the uid Column isn't unique.

uid is required to be unique for the the Changed Events (with the new Data) to be inserted without creating new Rows.
This commit is contained in:
2025-11-03 00:22:01 +00:00
parent 1a7de55da8
commit eea37b3df5
7 changed files with 86 additions and 7 deletions

View File

@@ -42,9 +42,9 @@ export class Event implements TEventEntity {
deleteDate: TEventEntity["deleteDate"];
static createTable (db: Database): void {
const query = db.query(`CREATE TABLE IF NOT EXISTS "events" (
"event_uid" INTEGER NOT NULL,
"uid" TEXT NOT NULL,
const query = db.query(`CREATE TABLE IF NOT EXISTS "events"
"event_uid" INTEGER PRIMARY KEY,
"uid" TEXT NOT NULL UNIQUE,
"title" TEXT NOT NULL,
"date_at" DATETIME NOT NULL,
"time_start" TEXT NOT NULL,
@@ -56,10 +56,8 @@ export class Event implements TEventEntity {
"description" TEXT NOT NULL,
"timezone" TEXT NOT NULL,
"notification" TEXT NOT NULL,
"deleteDate" INTEGER NULL,
PRIMARY KEY ("event_uid")
);
CREATE UNIQUE INDEX "sqlite_autoindex_events_1" ON "events" ("uid");`);
"deleteDate" INTEGER NULL
);`);
query.run();
}