-- CreateTable
CREATE TABLE "Model" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "title" TEXT NOT NULL,
    "image" TEXT NOT NULL,
    "likes" INTEGER,
    "downloads" INTEGER,
    "isPublic" BOOLEAN NOT NULL DEFAULT false,
    "hf_user_id" TEXT
);

-- CreateTable
CREATE TABLE "Gallery" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "hf_user_id" TEXT,
    "prompt" TEXT NOT NULL,
    "image" TEXT NOT NULL,
    "modelId" TEXT NOT NULL,
    CONSTRAINT "Gallery_modelId_fkey" FOREIGN KEY ("modelId") REFERENCES "Model" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);

-- CreateTable
CREATE TABLE "Reaction" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "emoji" TEXT NOT NULL,
    "hf_user_id" TEXT,
    "galleryId" TEXT,
    CONSTRAINT "Reaction_galleryId_fkey" FOREIGN KEY ("galleryId") REFERENCES "Gallery" ("id") ON DELETE SET NULL ON UPDATE CASCADE
);
