feat: add api generation

This commit is contained in:
BennyKok
2023-12-15 17:58:19 +08:00
parent e77da089d9
commit bbb7f398ab
15 changed files with 1213 additions and 45 deletions
+14
View File
@@ -203,5 +203,19 @@ export const deploymentsRelations = relations(deploymentsTable, ({ one }) => ({
}),
}));
export const apiKeyTable = dbSchema.table("api_keys", {
id: uuid("id").primaryKey().defaultRandom().notNull(),
key: text("key").notNull().unique(),
name: text("name").notNull(),
user_id: text("user_id")
.references(() => usersTable.id, {
onDelete: "cascade",
})
.notNull(),
org_id: text("org_id"),
created_at: timestamp("created_at").defaultNow().notNull(),
updated_at: timestamp("updated_at").defaultNow().notNull(),
});
export type UserType = InferSelectModel<typeof usersTable>;
export type WorkflowType = InferSelectModel<typeof workflowTable>;