新增 family_invite 家庭邀请码表(schema+0009迁移)
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
8c9d8ece1a
commit
da7f7a6a19
@@ -78,6 +78,21 @@ export const activationCodes = mysqlTable("activation_code", {
|
||||
usedAt: datetime("used_at"),
|
||||
});
|
||||
|
||||
// ===== 家庭邀请码(家长生成,其他家长凭码注册加入;一次性,15 分钟)=====
|
||||
export const familyInvites = mysqlTable("family_invite", {
|
||||
id: bigint("id", { mode: "number" }).primaryKey().autoincrement(),
|
||||
familyId: bigint("family_id", { mode: "number" })
|
||||
.notNull()
|
||||
.references(() => families.id, { onDelete: "cascade" }),
|
||||
codeHash: varchar("code_hash", { length: 64 }).notNull(),
|
||||
createdBy: bigint("created_by", { mode: "number" })
|
||||
.notNull()
|
||||
.references(() => users.id),
|
||||
createdAt: datetime("created_at").notNull().default(sql`CURRENT_TIMESTAMP`),
|
||||
expiresAt: datetime("expires_at").notNull(),
|
||||
usedAt: datetime("used_at"),
|
||||
});
|
||||
|
||||
// ===== 周模板(每个孩子 × 每周几 × 每条任务)=====
|
||||
export const taskTemplates = mysqlTable(
|
||||
"task_template",
|
||||
|
||||
Reference in New Issue
Block a user