Files
DianZhanDemo/server/prisma/migrations/20251111055448_add_user_tokens/migration.sql
ch197511161 aaaf08e8f3 init6
2025-12-11 02:09:07 +08:00

28 lines
869 B
SQL

/*
Warnings:
- You are about to drop the `feishu_tokens` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropTable
PRAGMA foreign_keys=off;
DROP TABLE "feishu_tokens";
PRAGMA foreign_keys=on;
-- CreateTable
CREATE TABLE "user_tokens" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"userId" INTEGER NOT NULL,
"access_token" TEXT NOT NULL,
"refresh_token" TEXT NOT NULL,
"expires_in" INTEGER NOT NULL,
"acquired_at" INTEGER NOT NULL,
"token_type" TEXT NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "user_tokens_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "user_tokens_userId_token_type_key" ON "user_tokens"("userId", "token_type");