/*
  Warnings:

  - You are about to drop the `RomFile` table. If the table is not empty, all the data it contains will be lost.
  - You are about to drop the column `extra` on the `Game` table. All the data in the column will be lost.
  - Added the required column `source` to the `Game` table without a default value. This is not possible if the table is not empty.

*/
-- DropIndex
DROP INDEX "RomFile_checksum_idx";

-- DropIndex
DROP INDEX "RomFile_checksum_key";

-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "RomFile";
PRAGMA foreign_keys=on;

-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_Game" (
    "id" TEXT NOT NULL PRIMARY KEY,
    "title" TEXT NOT NULL,
    "slug" TEXT NOT NULL,
    "description" TEXT,
    "releaseDate" DATETIME,
    "genre" TEXT,
    "platform" TEXT,
    "year" INTEGER,
    "cover" TEXT,
    "source" TEXT NOT NULL,
    "sourceId" TEXT,
    "romPath" TEXT,
    "romFilename" TEXT,
    "romSize" INTEGER,
    "romChecksum" TEXT,
    "romFormat" TEXT,
    "romHashes" TEXT,
    "igdbId" INTEGER,
    "rawgId" INTEGER,
    "thegamesdbId" INTEGER,
    "metadata" TEXT,
    "addedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "lastSeenAt" DATETIME,
    "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" DATETIME NOT NULL
);
INSERT INTO "new_Game" ("createdAt", "description", "id", "igdbId", "rawgId", "releaseDate", "slug", "thegamesdbId", "title", "updatedAt") SELECT "createdAt", "description", "id", "igdbId", "rawgId", "releaseDate", "slug", "thegamesdbId", "title", "updatedAt" FROM "Game";
DROP TABLE "Game";
ALTER TABLE "new_Game" RENAME TO "Game";
CREATE UNIQUE INDEX "Game_slug_key" ON "Game"("slug");
CREATE UNIQUE INDEX "Game_igdbId_key" ON "Game"("igdbId");
CREATE UNIQUE INDEX "Game_rawgId_key" ON "Game"("rawgId");
CREATE UNIQUE INDEX "Game_thegamesdbId_key" ON "Game"("thegamesdbId");
CREATE INDEX "Game_source_idx" ON "Game"("source");
CREATE INDEX "Game_sourceId_idx" ON "Game"("sourceId");
CREATE INDEX "Game_title_idx" ON "Game"("title");
CREATE INDEX "Game_romChecksum_idx" ON "Game"("romChecksum");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;
