Finish migration prisma to drizzle.

This commit is contained in:
charlesgauthereau
2025-07-16 18:15:28 +02:00
parent 385777535f
commit de9fe33194
21 changed files with 278 additions and 293 deletions
+2 -3
View File
@@ -11,7 +11,7 @@ export const database = pgTable("databases", {
agentDatabaseId: uuid("agent_database_id").notNull().defaultRandom(),
name: text("name").notNull(),
dbms: dbmsEnum("dbms").notNull(),
description: text("description").notNull(),
description: text("description"),
backupPolicy: text("backup_policy"),
isWaitingForBackup: boolean("is_waiting_for_backup").default(false).notNull(),
backupToRestore: text("backup_to_restore"),
@@ -23,8 +23,7 @@ export const database = pgTable("databases", {
lastContact: timestamp("last_contact"),
projectId: uuid("project_id")
.references(() => project.id)
.notNull(),
.references(() => project.id),
});
export const backup = pgTable(
+7
View File
@@ -1,6 +1,8 @@
import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
import { createSelectSchema } from "drizzle-zod";
import { z } from "zod";
import {database} from "@/db/schema/06_database";
import {relations} from "drizzle-orm";
export const agent = pgTable("agents", {
id: uuid("id").primaryKey().defaultRandom(),
@@ -14,3 +16,8 @@ export const agent = pgTable("agents", {
export const agentSchema = createSelectSchema(agent);
export type Agent = z.infer<typeof agentSchema>;
export const agentRelations = relations(agent, ({ many }) => ({
databases: many(database),
}));