mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: migrate rest schemas
This commit is contained in:
parent
7c62408070
commit
0d525398a8
32
apps/dokploy/drizzle/0068_sour_professor_monster.sql
Normal file
32
apps/dokploy/drizzle/0068_sour_professor_monster.sql
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
ALTER TABLE "project" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "destination" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "certificate" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "registry" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "notification" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "ssh-key" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "git_provider" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "server" RENAME COLUMN "adminId" TO "userId";--> statement-breakpoint
|
||||||
|
ALTER TABLE "project" DROP CONSTRAINT "project_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "destination" DROP CONSTRAINT "destination_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "certificate" DROP CONSTRAINT "certificate_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "registry" DROP CONSTRAINT "registry_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "notification" DROP CONSTRAINT "notification_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "ssh-key" DROP CONSTRAINT "ssh-key_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "git_provider" DROP CONSTRAINT "git_provider_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "server" DROP CONSTRAINT "server_adminId_admin_adminId_fk";
|
||||||
|
--> statement-breakpoint
|
||||||
|
ALTER TABLE "project" ADD CONSTRAINT "project_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "destination" ADD CONSTRAINT "destination_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "certificate" ADD CONSTRAINT "certificate_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "registry" ADD CONSTRAINT "registry_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "notification" ADD CONSTRAINT "notification_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "ssh-key" ADD CONSTRAINT "ssh-key_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "git_provider" ADD CONSTRAINT "git_provider_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||||
|
ALTER TABLE "server" ADD CONSTRAINT "server_userId_user_temp_id_fk" FOREIGN KEY ("userId") REFERENCES "public"."user_temp"("id") ON DELETE cascade ON UPDATE no action;
|
5278
apps/dokploy/drizzle/meta/0068_snapshot.json
Normal file
5278
apps/dokploy/drizzle/meta/0068_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -477,6 +477,13 @@
|
|||||||
"when": 1739427057545,
|
"when": 1739427057545,
|
||||||
"tag": "0067_migrate-data",
|
"tag": "0067_migrate-data",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 68,
|
||||||
|
"version": "7",
|
||||||
|
"when": 1739428942964,
|
||||||
|
"tag": "0068_sour_professor_monster",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -25,9 +25,9 @@ export const certificates = pgTable("certificate", {
|
|||||||
// userId: text("userId").references(() => user.userId, {
|
// userId: text("userId").references(() => user.userId, {
|
||||||
// onDelete: "cascade",
|
// onDelete: "cascade",
|
||||||
// }),
|
// }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
serverId: text("serverId").references(() => server.serverId, {
|
serverId: text("serverId").references(() => server.serverId, {
|
||||||
onDelete: "cascade",
|
onDelete: "cascade",
|
||||||
}),
|
}),
|
||||||
@ -40,9 +40,9 @@ export const certificatesRelations = relations(
|
|||||||
fields: [certificates.serverId],
|
fields: [certificates.serverId],
|
||||||
references: [server.serverId],
|
references: [server.serverId],
|
||||||
}),
|
}),
|
||||||
admin: one(admins, {
|
user: one(users_temp, {
|
||||||
fields: [certificates.adminId],
|
fields: [certificates.userId],
|
||||||
references: [admins.adminId],
|
references: [users_temp.id],
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -24,9 +24,9 @@ export const destinations = pgTable("destination", {
|
|||||||
// userId: text("userId")
|
// userId: text("userId")
|
||||||
// .notNull()
|
// .notNull()
|
||||||
// .references(() => user.userId, { onDelete: "cascade" }),
|
// .references(() => user.userId, { onDelete: "cascade" }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const destinationsRelations = relations(
|
export const destinationsRelations = relations(
|
||||||
|
@ -29,9 +29,9 @@ export const gitProvider = pgTable("git_provider", {
|
|||||||
// userId: text("userId").references(() => user.userId, {
|
// userId: text("userId").references(() => user.userId, {
|
||||||
// onDelete: "cascade",
|
// onDelete: "cascade",
|
||||||
// }),
|
// }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const gitProviderRelations = relations(gitProvider, ({ one, many }) => ({
|
export const gitProviderRelations = relations(gitProvider, ({ one, many }) => ({
|
||||||
|
@ -49,9 +49,9 @@ export const notifications = pgTable("notification", {
|
|||||||
// userId: text("userId").references(() => user.userId, {
|
// userId: text("userId").references(() => user.userId, {
|
||||||
// onDelete: "cascade",
|
// onDelete: "cascade",
|
||||||
// }),
|
// }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const slack = pgTable("slack", {
|
export const slack = pgTable("slack", {
|
||||||
@ -126,9 +126,9 @@ export const notificationsRelations = relations(notifications, ({ one }) => ({
|
|||||||
fields: [notifications.gotifyId],
|
fields: [notifications.gotifyId],
|
||||||
references: [gotify.gotifyId],
|
references: [gotify.gotifyId],
|
||||||
}),
|
}),
|
||||||
admin: one(admins, {
|
user: one(users_temp, {
|
||||||
fields: [notifications.adminId],
|
fields: [notifications.userId],
|
||||||
references: [admins.adminId],
|
references: [users_temp.id],
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -28,9 +28,9 @@ export const projects = pgTable("project", {
|
|||||||
// userId: text("userId")
|
// userId: text("userId")
|
||||||
// .notNull()
|
// .notNull()
|
||||||
// .references(() => user.userId, { onDelete: "cascade" }),
|
// .references(() => user.userId, { onDelete: "cascade" }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
env: text("env").notNull().default(""),
|
env: text("env").notNull().default(""),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ export const registry = pgTable("registry", {
|
|||||||
// userId: text("userId")
|
// userId: text("userId")
|
||||||
// .notNull()
|
// .notNull()
|
||||||
// .references(() => user.userId, { onDelete: "cascade" }),
|
// .references(() => user.userId, { onDelete: "cascade" }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const registryRelations = relations(registry, ({ one, many }) => ({
|
export const registryRelations = relations(registry, ({ one, many }) => ({
|
||||||
|
@ -47,9 +47,9 @@ export const server = pgTable("server", {
|
|||||||
// userId: text("userId")
|
// userId: text("userId")
|
||||||
// .notNull()
|
// .notNull()
|
||||||
// .references(() => user.userId, { onDelete: "cascade" }),
|
// .references(() => user.userId, { onDelete: "cascade" }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
serverStatus: serverStatus("serverStatus").notNull().default("active"),
|
serverStatus: serverStatus("serverStatus").notNull().default("active"),
|
||||||
command: text("command").notNull().default(""),
|
command: text("command").notNull().default(""),
|
||||||
sshKeyId: text("sshKeyId").references(() => sshKeys.sshKeyId, {
|
sshKeyId: text("sshKeyId").references(() => sshKeys.sshKeyId, {
|
||||||
|
@ -7,6 +7,7 @@ import { admins } from "./admin";
|
|||||||
import { applications } from "./application";
|
import { applications } from "./application";
|
||||||
import { compose } from "./compose";
|
import { compose } from "./compose";
|
||||||
import { server } from "./server";
|
import { server } from "./server";
|
||||||
|
import { users_temp } from "./user";
|
||||||
// import { user } from "./user";
|
// import { user } from "./user";
|
||||||
|
|
||||||
export const sshKeys = pgTable("ssh-key", {
|
export const sshKeys = pgTable("ssh-key", {
|
||||||
@ -25,19 +26,19 @@ export const sshKeys = pgTable("ssh-key", {
|
|||||||
// userId: text("userId").references(() => user.userId, {
|
// userId: text("userId").references(() => user.userId, {
|
||||||
// onDelete: "cascade",
|
// onDelete: "cascade",
|
||||||
// }),
|
// }),
|
||||||
adminId: text("adminId")
|
userId: text("userId")
|
||||||
.notNull()
|
.notNull()
|
||||||
.references(() => admins.adminId, { onDelete: "cascade" }),
|
.references(() => users_temp.id, { onDelete: "cascade" }),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const sshKeysRelations = relations(sshKeys, ({ many, one }) => ({
|
export const sshKeysRelations = relations(sshKeys, ({ many, one }) => ({
|
||||||
applications: many(applications),
|
applications: many(applications),
|
||||||
compose: many(compose),
|
compose: many(compose),
|
||||||
servers: many(server),
|
servers: many(server),
|
||||||
// user: one(user, {
|
user: one(users_temp, {
|
||||||
// fields: [sshKeys.userId],
|
fields: [sshKeys.userId],
|
||||||
// references: [user.id],
|
references: [users_temp.id],
|
||||||
// }),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const createSchema = createInsertSchema(
|
const createSchema = createInsertSchema(
|
||||||
|
@ -189,10 +189,10 @@ export const usersRelations = relations(users, ({ one }) => ({
|
|||||||
fields: [users.authId],
|
fields: [users.authId],
|
||||||
references: [auth.id],
|
references: [auth.id],
|
||||||
}),
|
}),
|
||||||
admin: one(admins, {
|
// admin: one(admins, {
|
||||||
fields: [users.adminId],
|
// fields: [users.adminId],
|
||||||
references: [admins.adminId],
|
// references: [admins.adminId],
|
||||||
}),
|
// }),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const createSchema = createInsertSchema(users, {
|
const createSchema = createInsertSchema(users, {
|
||||||
|
Loading…
Reference in New Issue
Block a user