rwadurian/backend/services/mpc-service/prisma/schema.prisma

52 lines
2.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// =============================================================================
// MPC Service - Prisma Schema
// =============================================================================
//
// mpc-service 作为 MPC 服务网关:
// 1. 缓存 username + publicKey 的映射关系
// 2. 存储 delegate share (由 mpc-system delegate server-party-api 返回)
//
// 所有其他 MPC 相关数据由 mpc-system 管理
//
// =============================================================================
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
// =============================================================================
// MPC Wallets Table (缓存用户公钥,用于本地快速查询)
// =============================================================================
model MpcWallet {
id String @id @default(uuid())
username String @unique @db.VarChar(255)
publicKey String @map("public_key") @db.Text
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@index([username], name: "idx_mw_username")
@@map("mpc_wallets")
}
// =============================================================================
// MPC Shares Table (存储 delegate share由 mpc-system 返回给用户)
// =============================================================================
model MpcShare {
id String @id @default(uuid())
username String @db.VarChar(255)
partyId String @map("party_id") @db.VarChar(255)
partyIndex Int @map("party_index")
encryptedShare String @map("encrypted_share") @db.Text
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@unique([username], name: "uq_ms_username")
@@index([username], name: "idx_ms_username")
@@map("mpc_shares")
}