feat(libsql): add support for libsql database backups and restores

- Updated backup and restore functionalities to include support for the 'libsql' database type.
- Enhanced the backup process with new methods for running and restoring libsql backups.
- Modified existing components and schemas to accommodate libsql, including updates to the database type enumerations and backup schemas.
- Removed obsolete bottomless replication features from the libsql schema.
- Updated related UI components to reflect changes in backup handling for libsql.
This commit is contained in:
Mauricio Siu
2026-03-19 16:00:39 -06:00
parent a03ec76b6f
commit bb56a0bae8
25 changed files with 8420 additions and 291 deletions
+3 -17
View File
@@ -3,7 +3,7 @@ import { boolean, integer, json, pgTable, text } from "drizzle-orm/pg-core";
import { createInsertSchema } from "drizzle-zod";
import { nanoid } from "nanoid";
import { z } from "zod";
import { destinations } from "./destination";
import { backups } from "./backups";
import { environments } from "./environment";
import { mounts } from "./mount";
import { server } from "./server";
@@ -43,14 +43,6 @@ export const libsql = pgTable("libsql", {
sqldNode: sqldNode("sqldNode").notNull().default("primary"),
sqldPrimaryUrl: text("sqldPrimaryUrl"),
enableNamespaces: boolean("enableNamespaces").notNull().default(false),
enableBottomlessReplication: boolean("enableBottomlessReplication")
.notNull()
.default(false),
bottomlessReplicationDestinationId: text(
"bottomlessReplicationDestinationId",
).references(() => destinations.destinationId, {
onDelete: "set null",
}),
dockerImage: text("dockerImage").notNull(),
command: text("command"),
env: text("env"),
@@ -92,16 +84,12 @@ export const libsqlRelations = relations(libsql, ({ one, many }) => ({
fields: [libsql.environmentId],
references: [environments.environmentId],
}),
//backups: many(backups),
backups: many(backups),
mounts: many(mounts),
server: one(server, {
fields: [libsql.serverId],
references: [server.serverId],
}),
bottomlessReplicationDestination: one(destinations, {
fields: [libsql.bottomlessReplicationDestinationId],
references: [destinations.destinationId],
}),
}));
const createSchema = createInsertSchema(libsql, {
@@ -119,9 +107,7 @@ const createSchema = createInsertSchema(libsql, {
sqldNode: z.enum(sqldNode.enumValues),
sqldPrimaryUrl: z.string().nullable(),
enableNamespaces: z.boolean().default(false),
enableBottomlessReplication: z.boolean().default(false),
bottomlessReplicationDestinationId: z.string().nullable(),
dockerImage: z.string().default("ghcr.io/tursodatabase/libsql-server:latest"),
dockerImage: z.string().default("ghcr.io/tursodatabase/libsql-server:v0.24.32"),
command: z.string().optional(),
env: z.string().optional(),
memoryReservation: z.string().optional(),