mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Update UpdateBackup component to enforce DatabaseType casting for backup databaseType. Modify backups schema to allow optional metadata field, enhancing flexibility for various database types.
This commit is contained in:
parent
6b9765a26c
commit
19bf4f27b6
@ -221,7 +221,7 @@ export const UpdateBackup = ({ backupId, refetch }: Props) => {
|
|||||||
databaseType:
|
databaseType:
|
||||||
backup?.backupType === "compose"
|
backup?.backupType === "compose"
|
||||||
? selectedDatabaseType
|
? selectedDatabaseType
|
||||||
: backup?.databaseType,
|
: (backup?.databaseType as DatabaseType),
|
||||||
})
|
})
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
toast.success("Backup Updated");
|
toast.success("Backup Updated");
|
||||||
|
@ -71,7 +71,8 @@ export const backups = pgTable("backup", {
|
|||||||
}),
|
}),
|
||||||
userId: text("userId").references(() => users_temp.id),
|
userId: text("userId").references(() => users_temp.id),
|
||||||
// Only for compose backups
|
// Only for compose backups
|
||||||
metadata: jsonb("metadata").$type<{
|
metadata: jsonb("metadata").$type<
|
||||||
|
| {
|
||||||
postgres?: {
|
postgres?: {
|
||||||
databaseUser: string;
|
databaseUser: string;
|
||||||
};
|
};
|
||||||
@ -86,7 +87,9 @@ export const backups = pgTable("backup", {
|
|||||||
mysql?: {
|
mysql?: {
|
||||||
databaseRootPassword: string;
|
databaseRootPassword: string;
|
||||||
};
|
};
|
||||||
}>(),
|
}
|
||||||
|
| undefined
|
||||||
|
>(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const backupsRelations = relations(backups, ({ one }) => ({
|
export const backupsRelations = relations(backups, ({ one }) => ({
|
||||||
@ -134,6 +137,7 @@ const createSchema = createInsertSchema(backups, {
|
|||||||
mysqlId: z.string().optional(),
|
mysqlId: z.string().optional(),
|
||||||
mongoId: z.string().optional(),
|
mongoId: z.string().optional(),
|
||||||
userId: z.string().optional(),
|
userId: z.string().optional(),
|
||||||
|
metadata: z.object({}).optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export const apiCreateBackup = createSchema.pick({
|
export const apiCreateBackup = createSchema.pick({
|
||||||
|
Loading…
Reference in New Issue
Block a user