refactor: update

This commit is contained in:
Mauricio Siu
2025-02-15 20:06:33 -06:00
parent 8b71f963cc
commit 87b12ff6e9
9 changed files with 10740 additions and 84 deletions

View File

@@ -14,6 +14,7 @@ import { mysql } from "./mysql";
import { postgres } from "./postgres";
import { redis } from "./redis";
import { users, users_temp } from "./user";
import { organization } from "./account";
export const projects = pgTable("project", {
projectId: text("projectId")
@@ -31,6 +32,9 @@ export const projects = pgTable("project", {
userId: text("userId")
.notNull()
.references(() => users_temp.id, { onDelete: "cascade" }),
organizationId: text("organizationId")
// .notNull()
.references(() => organization.id, { onDelete: "cascade" }),
env: text("env").notNull().default(""),
});
@@ -42,6 +46,10 @@ export const projectRelations = relations(projects, ({ many, one }) => ({
mongo: many(mongo),
redis: many(redis),
compose: many(compose),
user: one(users_temp, {
fields: [projects.userId],
references: [users_temp.id],
}),
// user: one(user, {
// fields: [projects.userId],
// references: [user.id],

View File

@@ -14,6 +14,7 @@ import { account, organization } from "./account";
import { admins } from "./admin";
import { auth } from "./auth";
import { certificateType } from "./shared";
import { projects } from "./project";
/**
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
* database instance for multiple projects.
@@ -199,6 +200,7 @@ export const usersRelations = relations(users_temp, ({ one, many }) => ({
// fields: [users.adminId],
// references: [admins.adminId],
// }),
projects: many(projects),
}));
const createSchema = createInsertSchema(users_temp, {