-- CreateTable
CREATE TABLE "connector_heartbeats" (
    "id" TEXT NOT NULL,
    "tenant_id" TEXT NOT NULL,
    "timestamp" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "latency_ms" INTEGER NOT NULL,
    "version" VARCHAR(20) NOT NULL,
    "pg_version" VARCHAR(50),
    "status" VARCHAR(20) NOT NULL,
    "error_msg" TEXT,

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

-- CreateIndex
CREATE INDEX "connector_heartbeats_tenant_id_timestamp_idx" ON "connector_heartbeats"("tenant_id", "timestamp");

-- AddForeignKey
ALTER TABLE "connector_heartbeats" ADD CONSTRAINT "connector_heartbeats_tenant_id_fkey" FOREIGN KEY ("tenant_id") REFERENCES "tenants"("id") ON DELETE CASCADE ON UPDATE CASCADE;
