mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Finish migration prisma to drizzle.
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -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),
|
||||
}));
|
||||
Reference in New Issue
Block a user