refactor(db): add explicit string length limits to users and tasks tables
All checks were successful
Deploy Flowstate to VPS / deploy (push) Successful in 1m45s
All checks were successful
Deploy Flowstate to VPS / deploy (push) Successful in 1m45s
This commit is contained in:
parent
c57f9ab6dc
commit
b94e7834be
1 changed files with 8 additions and 7 deletions
15
db/schema.ts
15
db/schema.ts
|
|
@ -11,6 +11,7 @@ import {
|
||||||
text,
|
text,
|
||||||
timestamp,
|
timestamp,
|
||||||
uuid,
|
uuid,
|
||||||
|
varchar,
|
||||||
} from "drizzle-orm/pg-core";
|
} from "drizzle-orm/pg-core";
|
||||||
|
|
||||||
// ==========================================
|
// ==========================================
|
||||||
|
|
@ -50,12 +51,12 @@ export const userRoleEnum = pgEnum("user_role", ["admin", "member", "guest"]);
|
||||||
*/
|
*/
|
||||||
export const usersTable = pgTable("users", {
|
export const usersTable = pgTable("users", {
|
||||||
id: uuid("id").defaultRandom().primaryKey(),
|
id: uuid("id").defaultRandom().primaryKey(),
|
||||||
email: text("email").notNull().unique(),
|
email: varchar("email", { length: 255 }).notNull().unique(),
|
||||||
password: text("password").notNull(),
|
password: text("password").notNull(),
|
||||||
firstName: text("first_name").notNull(),
|
firstName: varchar("first_name", { length: 50 }).notNull(),
|
||||||
lastName: text("last_name").notNull(),
|
lastName: varchar("last_name", { length: 50 }).notNull(),
|
||||||
role: text("role").default("member").notNull(),
|
role: userRoleEnum("role").default("member").notNull(),
|
||||||
color: text("color").default("bg-indigo-500").notNull(),
|
color: varchar("color", { length: 50 }).default("bg-indigo-500").notNull(),
|
||||||
lastLogin: timestamp("last_login"),
|
lastLogin: timestamp("last_login"),
|
||||||
isOnline: boolean("is_online").default(false).notNull(),
|
isOnline: boolean("is_online").default(false).notNull(),
|
||||||
createdAt: timestamp("created_at").defaultNow().notNull(),
|
createdAt: timestamp("created_at").defaultNow().notNull(),
|
||||||
|
|
@ -69,8 +70,8 @@ export const tasksTable = pgTable("tasks", {
|
||||||
userId: uuid("user_id")
|
userId: uuid("user_id")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => usersTable.id, { onDelete: "cascade" }),
|
.references(() => usersTable.id, { onDelete: "cascade" }),
|
||||||
title: text("title").notNull(),
|
title: varchar("title", { length: 255 }).notNull(),
|
||||||
description: text("description").notNull(),
|
description: varchar("description", { length: 2000 }).notNull(),
|
||||||
status: taskStatusEnum("status").default("todo").notNull(),
|
status: taskStatusEnum("status").default("todo").notNull(),
|
||||||
priority: taskPriorityEnum("priority").default("medium").notNull(),
|
priority: taskPriorityEnum("priority").default("medium").notNull(),
|
||||||
dueDate: timestamp("due_date").notNull(),
|
dueDate: timestamp("due_date").notNull(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue