mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: update
This commit is contained in:
@@ -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],
|
||||
|
||||
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user