This commit is contained in:
ch197511161
2025-12-11 02:09:07 +08:00
parent 54d6acbce3
commit aaaf08e8f3
84 changed files with 4131 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
-- CreateTable
CREATE TABLE "users" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"age" INTEGER,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- CreateIndex
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");

View File

@@ -0,0 +1,8 @@
-- CreateTable
CREATE TABLE "feishu_tokens" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"tenant_access_token" TEXT NOT NULL,
"expire" INTEGER NOT NULL,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);

View File

@@ -0,0 +1,27 @@
/*
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");

View File

@@ -0,0 +1,25 @@
/*
Warnings:
- You are about to drop the column `userId` on the `user_tokens` table. All the data in the column will be lost.
*/
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_user_tokens" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"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
);
INSERT INTO "new_user_tokens" ("access_token", "acquired_at", "createdAt", "expires_in", "id", "refresh_token", "token_type", "updatedAt") SELECT "access_token", "acquired_at", "createdAt", "expires_in", "id", "refresh_token", "token_type", "updatedAt" FROM "user_tokens";
DROP TABLE "user_tokens";
ALTER TABLE "new_user_tokens" RENAME TO "user_tokens";
CREATE UNIQUE INDEX "user_tokens_refresh_token_key" ON "user_tokens"("refresh_token");
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;

View File

@@ -0,0 +1,9 @@
-- CreateTable
CREATE TABLE "posts" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" TEXT NOT NULL,
"content" TEXT,
"published" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);

View File

@@ -0,0 +1,3 @@
# Please do not edit this file manually
# It should be added in your version-control system (i.e. Git)
provider = "sqlite"