# Conflicts: # generated/prisma/internal/class.ts # generated/prisma/internal/prismaNamespace.ts # generated/prisma/internal/prismaNamespaceBrowser.ts # generated/prisma/models/BoardColumn.ts # generated/prisma/models/Project.ts # generated/prisma/models/ProjectMember.ts # generated/prisma/models/Task.ts # generated/prisma/models/TaskMember.ts # generated/prisma/models/TaskTag.ts # generated/prisma/models/User.ts # server/routes/projects.js # server/routes/tasks.js # src/api/task.js
99 lines
2.3 KiB
JavaScript
99 lines
2.3 KiB
JavaScript
// PowerSync 客户端 schema (0.2.1 离线编辑)
|
|
// 表名/列名与 deploy/0.2.1/powersync/sync-config.yaml 的输出严格一致 (PascalCase + text 型 id 由 SDK 自建)
|
|
// 见 docs/V0.2/离线编辑模块/0.2.1实施方案.md
|
|
import { column, Schema, Table } from '@powersync/web'
|
|
|
|
// 时间/JSON 列在同步流里以文本落地, 本地按字符串读写 (JSON 列为 JSON 字符串)
|
|
const project = new Table(
|
|
{
|
|
uuid: column.text,
|
|
code: column.text,
|
|
name: column.text,
|
|
ownerId: column.text,
|
|
isPersonal: column.integer,
|
|
archived: column.integer,
|
|
notes: column.text,
|
|
taskKinds: column.text,
|
|
icon: column.text,
|
|
autoArchive: column.text,
|
|
createdAt: column.text,
|
|
updatedAt: column.text,
|
|
},
|
|
{ indexes: { code: ['code'] } },
|
|
)
|
|
|
|
const projectMember = new Table({
|
|
uuid: column.text,
|
|
projectId: column.text,
|
|
userId: column.text,
|
|
permission: column.text,
|
|
createdAt: column.text,
|
|
})
|
|
|
|
const boardColumn = new Table(
|
|
{
|
|
uuid: column.text,
|
|
projectId: column.text,
|
|
name: column.text,
|
|
sortOrder: column.integer,
|
|
boundStatus: column.text,
|
|
retention: column.text,
|
|
createdAt: column.text,
|
|
updatedAt: column.text,
|
|
},
|
|
{ indexes: { project: ['projectId'] } },
|
|
)
|
|
|
|
const task = new Table(
|
|
{
|
|
uuid: column.text,
|
|
projectId: column.text,
|
|
columnId: column.text,
|
|
parentId: column.text,
|
|
title: column.text,
|
|
description: column.text,
|
|
kind: column.text,
|
|
markDate: column.text,
|
|
status: column.text,
|
|
doneAt: column.text,
|
|
assigneeId: column.text,
|
|
creatorId: column.text,
|
|
extras: column.text,
|
|
sortOrder: column.integer,
|
|
number: column.integer,
|
|
archived: column.integer,
|
|
archivedAt: column.text,
|
|
archiveSource: column.text,
|
|
createdAt: column.text,
|
|
updatedAt: column.text,
|
|
},
|
|
{ indexes: { project: ['projectId'], column: ['columnId'], number: ['projectId', 'number'] } },
|
|
)
|
|
|
|
const taskMember = new Table({
|
|
uuid: column.text,
|
|
taskId: column.text,
|
|
userId: column.text,
|
|
})
|
|
|
|
const taskTag = new Table({
|
|
uuid: column.text,
|
|
taskId: column.text,
|
|
name: column.text,
|
|
})
|
|
|
|
const user = new Table({
|
|
name: column.text,
|
|
email: column.text,
|
|
})
|
|
|
|
export const AppSchema = new Schema({
|
|
Project: project,
|
|
ProjectMember: projectMember,
|
|
BoardColumn: boardColumn,
|
|
Task: task,
|
|
TaskMember: taskMember,
|
|
TaskTag: taskTag,
|
|
User: user,
|
|
})
|