Updated Telegram notification
This commit is contained in:
@@ -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";
|
||||
Reference in New Issue
Block a user