@allbluecn/database 0.4.14 → 0.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/enums.ts +2 -2
- package/generated/internal/class.ts +1 -1
- package/generated-sqlite/browser.ts +0 -10
- package/generated-sqlite/client.ts +0 -10
- package/generated-sqlite/internal/class.ts +4 -24
- package/generated-sqlite/internal/prismaNamespace.ts +2 -180
- package/generated-sqlite/internal/prismaNamespaceBrowser.ts +1 -29
- package/generated-sqlite/models/User.ts +101 -1067
- package/generated-sqlite/models.ts +0 -2
- package/migrations/20260830000000_story_dependency_plane_align/migration.sql +37 -0
- package/package.json +2 -2
- package/schema.prisma +2 -2
- package/generated-sqlite/models/Notification.ts +0 -1482
- package/generated-sqlite/models/NotificationPreference.ts +0 -1287
|
@@ -86,6 +86,4 @@ export type * from './models/ComplianceExport'
|
|
|
86
86
|
export type * from './models/UserAgent'
|
|
87
87
|
export type * from './models/UserSkill'
|
|
88
88
|
export type * from './models/DeveloperLog'
|
|
89
|
-
export type * from './models/Notification'
|
|
90
|
-
export type * from './models/NotificationPreference'
|
|
91
89
|
export type * from './commonInputTypes'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
-- 依赖关系存储规范化(对齐 Plane):
|
|
2
|
+
-- 旧模型 4 值(BLOCKS / BLOCKED_BY / RELATES_TO)→ 新模型 3 正向值
|
|
3
|
+
-- (BLOCKS / STARTS_BEFORE / FINISHES_BEFORE),语义统一为「source 领先于 target」。
|
|
4
|
+
-- 本迁移需先清理数据再重建 enum,否则 USING cast 会因残留旧值失败。
|
|
5
|
+
|
|
6
|
+
-- 1. 删除 RELATES_TO(Plane 中属于 Relation,不属于依赖)
|
|
7
|
+
DELETE FROM "story_dependencies" WHERE "type" = 'RELATES_TO';
|
|
8
|
+
|
|
9
|
+
-- 2. 删除翻转后与现存 BLOCKS 重复的 BLOCKED_BY 行
|
|
10
|
+
DELETE FROM "story_dependencies" d
|
|
11
|
+
WHERE d."type" = 'BLOCKED_BY'
|
|
12
|
+
AND EXISTS (
|
|
13
|
+
SELECT 1 FROM "story_dependencies" b
|
|
14
|
+
WHERE b."type" = 'BLOCKS'
|
|
15
|
+
AND b."sourceId" = d."targetId"
|
|
16
|
+
AND b."targetId" = d."sourceId"
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
-- 3. BLOCKED_BY 翻转(X BLOCKED_BY Y ≡ Y BLOCKS X;PG UPDATE 右侧均取旧值,可直接交换)
|
|
20
|
+
UPDATE "story_dependencies"
|
|
21
|
+
SET "sourceId" = "targetId", "targetId" = "sourceId", "type" = 'BLOCKS'
|
|
22
|
+
WHERE "type" = 'BLOCKED_BY';
|
|
23
|
+
|
|
24
|
+
-- 4. enum 重建为 3 正向值
|
|
25
|
+
DO $$
|
|
26
|
+
BEGIN
|
|
27
|
+
IF EXISTS (SELECT 1 FROM pg_type WHERE typname = 'DependencyType_old') THEN
|
|
28
|
+
EXECUTE 'DROP TYPE "DependencyType_old"';
|
|
29
|
+
END IF;
|
|
30
|
+
END $$;
|
|
31
|
+
|
|
32
|
+
ALTER TYPE "DependencyType" RENAME TO "DependencyType_old";
|
|
33
|
+
CREATE TYPE "DependencyType" AS ENUM ('BLOCKS', 'STARTS_BEFORE', 'FINISHES_BEFORE');
|
|
34
|
+
ALTER TABLE "story_dependencies"
|
|
35
|
+
ALTER COLUMN "type" TYPE "DependencyType"
|
|
36
|
+
USING ("type"::text::"DependencyType");
|
|
37
|
+
DROP TYPE "DependencyType_old";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allbluecn/database",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"pg": "^8.22.0",
|
|
16
16
|
"sqlite-vec": "^0.1.9",
|
|
17
17
|
"bcryptjs": "^3.0.2",
|
|
18
|
-
"@allbluecn/shared": "0.4.
|
|
18
|
+
"@allbluecn/shared": "0.4.16"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@types/better-sqlite3": "^7.6.13",
|