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

-- CreateTable
CREATE TABLE "app_versions" (
    "id" TEXT NOT NULL,
    "platform" "Platform" NOT NULL,
    "version_code" INTEGER NOT NULL,
    "version_name" TEXT NOT NULL,
    "build_number" TEXT NOT NULL,
    "download_url" TEXT NOT NULL,
    "file_size" BIGINT NOT NULL,
    "file_sha256" TEXT NOT NULL,
    "min_os_version" TEXT,
    "changelog" TEXT NOT NULL,
    "is_force_update" BOOLEAN NOT NULL DEFAULT false,
    "is_enabled" BOOLEAN NOT NULL DEFAULT true,
    "release_date" TIMESTAMP(3),
    "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updated_at" TIMESTAMP(3) NOT NULL,
    "created_by" TEXT NOT NULL,
    "updated_by" TEXT,

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

-- CreateIndex
CREATE INDEX "app_versions_platform_is_enabled_idx" ON "app_versions"("platform", "is_enabled");

-- CreateIndex
CREATE INDEX "app_versions_platform_version_code_idx" ON "app_versions"("platform", "version_code");
