Add libsql schema with new table and constraints; remove serviceType references

This commit is contained in:
Mauricio Siu
2025-09-21 02:58:53 -06:00
parent 2dffdffaf3
commit 02f0b0b1a4
5 changed files with 6 additions and 71 deletions
-30
View File
@@ -12,17 +12,6 @@ import { mysql } from "./mysql";
import { postgres } from "./postgres";
import { redis } from "./redis";
export const serviceType = pgEnum("serviceType", [
"application",
"compose",
"libsql",
"mariadb",
"mongo",
"mysql",
"postgres",
"redis",
]);
export const mountType = pgEnum("mountType", ["bind", "volume", "file"]);
export const mounts = pgTable("mount", {
@@ -35,7 +24,6 @@ export const mounts = pgTable("mount", {
volumeName: text("volumeName"),
filePath: text("filePath"),
content: text("content"),
serviceType: serviceType("serviceType").notNull().default("application"),
mountPath: text("mountPath").notNull(),
applicationId: text("applicationId").references(
() => applications.applicationId,
@@ -108,24 +96,8 @@ const createSchema = createInsertSchema(mounts, {
mountPath: z.string().min(1),
mountId: z.string().optional(),
filePath: z.string().optional(),
serviceType: z
.enum([
"application",
"compose",
"libsql",
"mariadb",
"mongo",
"mysql",
"postgres",
"redis",
])
.default("application"),
});
export type ServiceType = NonNullable<
z.infer<typeof createSchema>["serviceType"]
>;
export const apiCreateMount = createSchema
.pick({
type: true,
@@ -133,7 +105,6 @@ export const apiCreateMount = createSchema
volumeName: true,
content: true,
mountPath: true,
serviceType: true,
filePath: true,
})
.extend({
@@ -161,7 +132,6 @@ export const apiFindMountByApplicationId = createSchema
})
.pick({
serviceId: true,
serviceType: true,
})
.required();
@@ -10,7 +10,6 @@ import { destinations } from "./destination";
import { libsql } from "./libsql";
import { mariadb } from "./mariadb";
import { mongo } from "./mongo";
import { serviceType } from "./mount";
import { mysql } from "./mysql";
import { postgres } from "./postgres";
import { redis } from "./redis";
@@ -24,7 +23,6 @@ export const volumeBackups = pgTable("volume_backup", {
name: text("name").notNull(),
volumeName: text("volumeName").notNull(),
prefix: text("prefix").notNull(),
serviceType: serviceType("serviceType").notNull().default("application"),
appName: text("appName")
.notNull()
.$defaultFn(() => generateAppName("volumeBackup")),