This commit is contained in:
Owen Schwartz 2024-10-10 22:00:32 -04:00
commit 33990da68c
No known key found for this signature in database
GPG key ID: 8271FDFFD9E0CCBD
16 changed files with 215 additions and 24 deletions

View file

@ -81,6 +81,7 @@ export const users = sqliteTable("user", {
emailVerified: integer("emailVerified", { mode: "boolean" })
.notNull()
.default(false),
dateCreated: text("dateCreated").notNull(),
});
export const twoFactorBackupCodes = sqliteTable("twoFactorBackupCodes", {
@ -107,7 +108,9 @@ export const userOrgs = sqliteTable("userOrgs", {
orgId: integer("orgId")
.notNull()
.references(() => orgs.orgId),
roleId: integer("roleId").notNull().references(() => roles.roleId),
roleId: integer("roleId")
.notNull()
.references(() => roles.roleId),
});
export const emailVerificationCodes = sqliteTable("emailVerificationCodes", {
@ -205,7 +208,9 @@ export const userResources = sqliteTable("userResources", {
export const limitsTable = sqliteTable("limits", {
limitId: integer("limitId").primaryKey({ autoIncrement: true }),
orgId: integer("orgId").references(() => orgs.orgId, { onDelete: "cascade" }),
orgId: integer("orgId").references(() => orgs.orgId, {
onDelete: "cascade",
}),
name: text("name").notNull(),
value: integer("value").notNull(),
description: text("description"),
@ -233,4 +238,4 @@ export type RoleSite = InferSelectModel<typeof roleSites>;
export type UserSite = InferSelectModel<typeof userSites>;
export type RoleResource = InferSelectModel<typeof roleResources>;
export type UserResource = InferSelectModel<typeof userResources>;
export type Limit = InferSelectModel<typeof limitsTable>;
export type Limit = InferSelectModel<typeof limitsTable>;