refactor(prisma): 将数据库从 SQLite 迁移至 PostgreSQL

删除 SQLite 相关依赖、配置和生成文件,更新 Prisma schema 以使用 PostgreSQL 作为数据源。
移除本地 dev.db 文件、libsql 适配器和旧迁移文件,简化 Prisma 客户端初始化。
This commit is contained in:
2026-03-11 01:39:14 +08:00
parent 35d835f68c
commit 617300eaaf
26 changed files with 14 additions and 12578 deletions

View File

@@ -1,30 +0,0 @@
-- CreateTable
CREATE TABLE "resources" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL,
"description" TEXT,
"url" TEXT NOT NULL,
"icon" TEXT,
"category" TEXT,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL
);
-- RedefineTables
PRAGMA defer_foreign_keys=ON;
PRAGMA foreign_keys=OFF;
CREATE TABLE "new_posts" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL,
"content" TEXT NOT NULL,
"user_id" TEXT NOT NULL,
"published" BOOLEAN NOT NULL DEFAULT false,
"createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" DATETIME NOT NULL,
CONSTRAINT "posts_user_id_fkey" FOREIGN KEY ("user_id") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
);
INSERT INTO "new_posts" ("content", "createdAt", "id", "title", "updatedAt", "user_id") SELECT "content", "createdAt", "id", "title", "updatedAt", "user_id" FROM "posts";
DROP TABLE "posts";
ALTER TABLE "new_posts" RENAME TO "posts";
PRAGMA foreign_keys=ON;
PRAGMA defer_foreign_keys=OFF;