-- CreateEnum
CREATE TYPE "Platform" AS ENUM ('ANDROID', 'IOS');

-- CreateTable
CREATE TABLE "app_versions" (
    "id" TEXT NOT NULL,
    "platform" "Platform" NOT NULL,
    "versionCode" INTEGER NOT NULL,
    "versionName" TEXT NOT NULL,
    "buildNumber" TEXT NOT NULL,
    "downloadUrl" TEXT NOT NULL,
    "fileSize" BIGINT NOT NULL,
    "fileSha256" TEXT NOT NULL,
    "minOsVersion" TEXT,
    "changelog" TEXT NOT NULL,
    "isForceUpdate" BOOLEAN NOT NULL DEFAULT false,
    "isEnabled" BOOLEAN NOT NULL DEFAULT true,
    "releaseDate" TIMESTAMP(3),
    "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMP(3) NOT NULL,
    "createdBy" TEXT NOT NULL,
    "updatedBy" TEXT,

    CONSTRAINT "app_versions_pkey" PRIMARY KEY ("id")
);

-- CreateIndex
CREATE INDEX "app_versions_platform_isEnabled_idx" ON "app_versions"("platform", "isEnabled");

-- CreateIndex
CREATE INDEX "app_versions_platform_versionCode_idx" ON "app_versions"("platform", "versionCode");
