Updated Telegram notification

This commit is contained in:
Jose Selesan
2026-08-05 13:56:52 -03:00
parent 4784242a35
commit 0407a79e1e
4 changed files with 143 additions and 52 deletions

View File

@@ -0,0 +1,26 @@
-- CreateEnum
CREATE TYPE "PriceDirection" AS ENUM ('MAX', 'MIN');
-- CreateTable
CREATE TABLE "telegram_daily_price_notifications" (
"id" TEXT NOT NULL,
"date" TIMESTAMP(3) NOT NULL,
"quoteType" "QuoteType" NOT NULL,
"direction" "PriceDirection" NOT NULL,
"value" MONEY NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
CONSTRAINT "telegram_daily_price_notifications_pkey" PRIMARY KEY ("id")
);
-- Migrate existing max records (if any)
INSERT INTO "telegram_daily_price_notifications" ("id", "date", "quoteType", "direction", "value", "createdAt", "updatedAt")
SELECT "id", "date", "quoteType", 'MAX'::"PriceDirection", "maxValue", "createdAt", "updatedAt"
FROM "telegram_daily_max_notifications";
-- CreateIndex
CREATE UNIQUE INDEX "telegram_daily_price_notifications_date_quoteType_direction_key" ON "telegram_daily_price_notifications"("date", "quoteType", "direction");
-- DropTable
DROP TABLE "telegram_daily_max_notifications";