Maybe final DB table

feat/db
Antonio De Lucreziis 2 years ago
parent 2ce1ac9bf1
commit 2485133661

@ -13,29 +13,31 @@ CREATE TABLE IF NOT EXISTS "dispense"(
);
-- Contenuto caricato
CREATE TABLE IF NOT EXISTS "uploaded_contents"(
CREATE TABLE IF NOT EXISTS "uploads"(
"id" TEXT NOT NULL PRIMARY KEY,
"created_at" TEXT NOT NULL,
"owner_id" TEXT NOT NULL,
"dispensa_id" TEXT NOT NULL,
"hash" TEXT NOT NULL
"file" TEXT NOT NULL,
FOREIGN KEY (dispensa_id) REFERENCES dispense(id)
);
-- Contenuti con hash approvati
CREATE TABLE IF NOT EXISTS "hash_approvals"(
CREATE TABLE IF NOT EXISTS "file_approvals"(
"id" TEXT NOT NULL PRIMARY KEY,
"created_at" TEXT NOT NULL,
"owner_id" TEXT NOT NULL,
"hash" TEXT NOT NULL
"created_at" TEXT NOT NULL,
"owner_id" TEXT NOT NULL, -- Moderatore che ha creato questa approvazione
"upload_id" TEXT NOT NULL, -- Upload a cui si riferisce questa approvazione
"status" TEXT NOT NULL, -- Risultato dell'approvazione: "approved" | "rejected"
FOREIGN KEY (upload_id) REFERENCES uploads(id)
);
-- Contenuti con hash rifiutati
CREATE TABLE IF NOT EXISTS "hash_rejections"(
"id" TEXT NOT NULL PRIMARY KEY,
"created_at" TEXT NOT NULL,
"owner_id" TEXT NOT NULL,
"hash" TEXT NOT NULL
);
-- Download counter
CREATE TABLE IF NOT EXISTS "downloads"(
"dispensa_id" TEXT NOT NULL,
"timestamp" TEXT NOT NULL,
FOREIGN KEY (dispensa_id) REFERENCES dispense(id)
)
--
-- Relations
@ -44,5 +46,6 @@ CREATE TABLE IF NOT EXISTS "hash_rejections"(
-- Tags per le dispense
CREATE TABLE IF NOT EXISTS "tags"(
"dispensa_id" TEXT NOT NULL,
"tags" TEXT NOT NULL
"name" TEXT NOT NULL,
FOREIGN KEY (dispensa_id) REFERENCES dispense(id)
);

Loading…
Cancel
Save