File size: 3,627 Bytes
db242f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
/*
Warnings:
- You are about to drop the column `deleted` on the `ChatMessage` table. All the data in the column will be lost.
- The primary key for the `OpenAIKey` table will be changed. If it partially fails, the table could be left without primary key constraint.
- The primary key for the `Setting` table will be changed. If it partially fails, the table could be left without primary key constraint.
- You are about to drop the column `createdAt` on the `Setting` table. All the data in the column will be lost.
- You are about to drop the column `id` on the `Setting` table. All the data in the column will be lost.
- You are about to drop the column `updatedAt` on the `Setting` table. All the data in the column will be lost.
- The `value` column on the `Setting` table would be dropped and recreated. This will lead to data loss if there is data in the column.
- You are about to drop the `RateLimit` table. If the table is not empty, all the data it contains will be lost.
- A unique constraint covering the columns `[key]` on the table `OpenAIKey` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateEnum
CREATE TYPE "OpenAIKeyStatus" AS ENUM ('Active', 'Disabled', 'Expired');
-- AlterEnum
-- This migration adds more than one value to an enum.
-- With PostgreSQL versions 11 and earlier, this is not possible
-- in a single migration. This can be worked around by creating
-- multiple migrations, each migration adding only one value to
-- the enum.
ALTER TYPE "OAuthProvider" ADD VALUE 'Apple';
ALTER TYPE "OAuthProvider" ADD VALUE 'Google';
ALTER TYPE "OAuthProvider" ADD VALUE 'Microsofe';
-- DropIndex
DROP INDEX "Setting_key_key";
-- AlterTable
ALTER TABLE "Announcement" ADD COLUMN "isHidden" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "sortOrder" DOUBLE PRECISION;
-- AlterTable
ALTER TABLE "Category" ADD COLUMN "sortOrder" DOUBLE PRECISION;
-- AlterTable
ALTER TABLE "ChatMessage" DROP COLUMN "deleted",
ADD COLUMN "isBlocked" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "isDeleted" BOOLEAN NOT NULL DEFAULT false;
-- AlterTable
ALTER TABLE "ChatSession" ADD COLUMN "isBlocked" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "isDeleted" BOOLEAN NOT NULL DEFAULT false;
-- AlterTable
ALTER TABLE "Model" ADD COLUMN "isDisabled" BOOLEAN NOT NULL DEFAULT false,
ADD COLUMN "label" TEXT,
ADD COLUMN "sortOrder" DOUBLE PRECISION;
-- AlterTable
ALTER TABLE "OpenAIKey" DROP CONSTRAINT "OpenAIKey_pkey",
ADD COLUMN "expiredAt" TIMESTAMP(3),
ADD COLUMN "id" SERIAL NOT NULL,
ADD COLUMN "note" TEXT,
ADD COLUMN "priceRatio" DOUBLE PRECISION,
ADD COLUMN "rateLimit" INTEGER,
ADD COLUMN "status" "OpenAIKeyStatus" NOT NULL DEFAULT 'Active',
ADD COLUMN "tokenUsage" DOUBLE PRECISION,
ADD COLUMN "total" DOUBLE PRECISION,
ADD COLUMN "url" TEXT,
ADD COLUMN "usage" DOUBLE PRECISION,
ALTER COLUMN "weight" DROP NOT NULL,
ALTER COLUMN "weight" DROP DEFAULT,
ADD CONSTRAINT "OpenAIKey_pkey" PRIMARY KEY ("id");
-- AlterTable
ALTER TABLE "Product" ADD COLUMN "sortOrder" DOUBLE PRECISION;
-- AlterTable
ALTER TABLE "Setting" DROP CONSTRAINT "Setting_pkey",
DROP COLUMN "createdAt",
DROP COLUMN "id",
DROP COLUMN "updatedAt",
DROP COLUMN "value",
ADD COLUMN "value" JSONB,
ADD CONSTRAINT "Setting_pkey" PRIMARY KEY ("key");
-- DropTable
DROP TABLE "RateLimit";
-- CreateTable
CREATE TABLE "Cache" (
"key" TEXT NOT NULL,
"value" JSONB,
CONSTRAINT "Cache_pkey" PRIMARY KEY ("key")
);
-- CreateIndex
CREATE UNIQUE INDEX "OpenAIKey_key_key" ON "OpenAIKey"("key");
|