[] = [
- {
- id: "provider",
- header: "Provider",
- cell: ({row}) => {
- return (
-
- {providerSwitch(row.original.providerId)}
-
-
- )
-
- },
- },
- {
- header: "Action",
- id: "actions",
- cell: ({row, table}) => {
- const router = useRouter();
-
- const mutation = useMutation({
- mutationFn: async () => {
- if (row.original.providerId === "credential") {
- toast.error(`This provider cannot be unlinked.`);
- router.refresh();
- return;
- }
-
- if (table.getRowModel().rows.length <= 1) {
- toast.error(`You only have one provider linked to your account. Please add more one to unlink this`);
- router.refresh();
- return;
- }
-
- const status = await unlinkUserProviderAction({
- provider: row.original.providerId,
- account: row.original.accountId,
- });
-
- if (status?.serverError || !status) {
- toast.error(status?.serverError);
- return;
- }
- toast.success(`Provider unlinked successfully.`);
- router.refresh();
- },
- });
-
- return (
-
- }
- onClick={async () => {
- await mutation.mutateAsync();
- }}
- size="icon"
- />
-
- );
- },
- },
-];
diff --git a/src/components/wrappers/dashboard/admin/users2/admin-user-table.tsx b/src/components/wrappers/dashboard/admin/users2/admin-user-table.tsx
deleted file mode 100644
index 8bfd93e7..00000000
--- a/src/components/wrappers/dashboard/admin/users2/admin-user-table.tsx
+++ /dev/null
@@ -1,29 +0,0 @@
-import {UserWithAccounts} from "@/db/schema/02_user";
-import {Card, CardContent, CardDescription, CardHeader, CardTitle} from "@/components/ui/card";
-import {DataTable} from "@/components/wrappers/common/table/data-table";
-import {usersColumnsAdmin} from "@/components/wrappers/dashboard/admin/users/columns-users";
-
-export type AdminUsersTableProps = {
- users: UserWithAccounts[];
-
-};
-
-export const AdminUsersTable = (props: AdminUsersTableProps) => {
- const {users} = props;
- return (
-
-
-
- Active users
- Manage your users
-
-
-
-
-
-
- );
-};
diff --git a/src/components/wrappers/dashboard/admin/users2/button-delete-use.tsx b/src/components/wrappers/dashboard/admin/users2/button-delete-use.tsx
deleted file mode 100644
index 80886fa4..00000000
--- a/src/components/wrappers/dashboard/admin/users2/button-delete-use.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-"use client";
-
-import {Trash2} from "lucide-react";
-import {ButtonWithConfirm} from "@/components/wrappers/common/button/button-with-confirm";
-import {useMutation} from "@tanstack/react-query";
-import {useRouter} from "next/navigation";
-import {toast} from "sonner";
-import {deleteUserAction} from "@/components/wrappers/dashboard/profile2/button-delete-account/delete-account.action";
-
-export type ButtonDeleteUserProps = {
- userId: string;
- disabled?: boolean;
-};
-
-export const ButtonDeleteUser = (props: ButtonDeleteUserProps) => {
- const router = useRouter();
-
- const mutation = useMutation({
- mutationFn: () => deleteUserAction(props.userId),
- onSuccess: async () => {
- toast.success("User deleted successfully.");
- router.refresh();
- },
- });
-
- return (
-
-
- ,
- },
- confirm: {
- className: "w-full",
- text: "Delete",
- icon: ,
- variant: "destructive",
- onClick: () => {
- mutation.mutate()
- },
- },
- cancel: {
- className: "w-full",
- text: "Cancel",
- icon: ,
- variant: "outline",
- },
- }}
- isPending={mutation.isPending}
- />
-
- );
-};
diff --git a/src/components/wrappers/dashboard/admin/users2/columns-users.tsx b/src/components/wrappers/dashboard/admin/users2/columns-users.tsx
deleted file mode 100644
index 669e6fa5..00000000
--- a/src/components/wrappers/dashboard/admin/users2/columns-users.tsx
+++ /dev/null
@@ -1,108 +0,0 @@
-"use client"
-import {ColumnDef} from "@tanstack/react-table";
-import {Badge} from "@/components/ui/badge";
-import {updateUserAction} from "@/components/wrappers/dashboard/profile2/user-form/user-form.action";
-import {useMutation} from "@tanstack/react-query";
-import {toast} from "sonner";
-import {useRouter} from "next/navigation";
-import {useState} from "react";
-import {UserWithAccounts} from "@/db/schema/02_user";
-import {authClient, useSession} from "@/lib/auth/auth-client";
-import {providerSwitch} from "@/components/wrappers/common/provider-switch";
-import {ButtonDeleteUser} from "@/components/wrappers/dashboard/admin/users/button-delete-use";
-import {formatLocalizedDate} from "@/utils/date-formatting";
-
-export const usersColumnsAdmin: ColumnDef[] = [
- {
- accessorKey: "role",
- header: "Role",
- cell: ({row}) => {
- const [role, setRole] = useState(row.getValue("role"));
-
- const {data: session, isPending, error} = authClient.useSession();
- const isSuperAdmin = session?.user.role == "superadmin";
- const isCurrentUser = session?.user.email === row.original.email;
-
- const updateMutation = useMutation({
- mutationFn: () => updateUserAction({id: row.original.id, data: {role: role}}),
- onSuccess: () => {
- toast.success(`User updated successfully.`);
- },
- onError: () => {
- toast.error(`An error occurred while updating user information.`);
- },
- });
-
- const handleUpdateRole = async () => {
- const nextRole = role === "admin" ? "pending" : role === "pending" ? "user" : "admin";
- setRole(nextRole);
- await updateMutation.mutateAsync();
- };
-
-
- if (isPending) return null;
-
- if (error || !session) {
- return null;
- }
-
-
- return (
- handleUpdateRole()}
- variant="outline"
- >
- {role}
-
- );
- },
- },
- {
- accessorKey: "name",
- header: "Name",
- },
- {
- accessorKey: "email",
- header: "Email",
- },
- {
- accessorKey: "accounts",
- header: "Provider(s)",
- cell: ({row}) => {
- return (
-
- {row.original.accounts.map((item) => (
-
- {providerSwitch(item.providerId, true)}
-
- ))}
-
- )
- }
- },
- {
- accessorKey: "updatedAt",
- header: "Updated At",
- cell: ({row}) => {
- return formatLocalizedDate(row.getValue("updatedAt"))
- },
- },
- {
- header: "Action",
- id: "actions",
- cell: ({row}) => {
- const router = useRouter();
- const {data: session, isPending, error} = useSession();
- const isSuperAdmin = session?.user.role == "superadmin";
-
- if (isPending || error) return null;
-
- return (
-
- );
- },
- },
-];
diff --git a/src/components/wrappers/dashboard/admin/users2/sessions/table-columns.tsx b/src/components/wrappers/dashboard/admin/users2/sessions/table-columns.tsx
deleted file mode 100644
index 8c6e4760..00000000
--- a/src/components/wrappers/dashboard/admin/users2/sessions/table-columns.tsx
+++ /dev/null
@@ -1,89 +0,0 @@
-import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading";
-import {useMutation} from "@tanstack/react-query";
-import {ColumnDef} from "@tanstack/react-table";
-import {Session} from "better-auth";
-import {Unlink} from "lucide-react";
-import {toast} from "sonner";
-import {useRouter} from "next/navigation";
-import detectOSWithUA from "@/utils/os-parser";
-import {Icon} from "@iconify/react";
-import {authClient} from "@/lib/auth/auth-client";
-import {timeAgo} from "@/utils/date-formatting";
-import {deleteUserSessionAction} from "@/components/wrappers/dashboard/profile2/user-form/user-form.action";
-
-export const sessionsColumns: ColumnDef[] = [
- {
- accessorKey: "expiresAt",
- header: "Expires At",
- cell: ({row}) => {
- return timeAgo(row.original.expiresAt);
- },
- },
- {
- id: "device",
- header: "Device",
- cell: ({row}) => {
- const os = detectOSWithUA(row.original.userAgent!);
-
- return (
-
- {os.icon &&
- }
- {os.showText && {os.name}}
-
- );
- },
- },
- {
- accessorKey: "userAgent",
- header: "User Agent",
- },
- {
- header: "Action",
- id: "actions",
- cell: ({row}) => {
- const router = useRouter();
-
- const {data: session, isPending, error} = authClient.useSession();
-
-
- const mutation = useMutation({
- mutationFn: async () => {
- if (session?.session.id === row.original.id) {
- toast.error(`Unable to unlink active session.`);
- router.refresh();
- return;
- }
-
- const status = await deleteUserSessionAction(row.original.token);
-
- if (status?.serverError || !status) {
- toast.error(status?.serverError);
- return;
- }
- toast.success(`Session deleted successfully.`);
- router.refresh();
- },
- });
-
-
- if (isPending || error) return null;
-
-
- return (
-
- }
- onClick={async () => {
- await mutation.mutateAsync();
- }}
- size="icon"
- />
-
- );
- },
- },
-];
diff --git a/src/components/wrappers/dashboard/database/import/upload-backup.action.ts b/src/components/wrappers/dashboard/database/import/upload-backup.action.ts
index 2b8252d6..51503a39 100644
--- a/src/components/wrappers/dashboard/database/import/upload-backup.action.ts
+++ b/src/components/wrappers/dashboard/database/import/upload-backup.action.ts
@@ -10,6 +10,7 @@ import {eq} from "drizzle-orm";
import {uploadLocalPrivate, uploadS3Private} from "@/features/upload/private/upload.action";
import {z} from "zod";
import {env} from "@/env.mjs";
+import {storeBackupFiles} from "@/features/storages/helpers";
export const uploadBackupAction = userAction
@@ -23,7 +24,8 @@ export const uploadBackupAction = userAction
where: eq(drizzleDb.schemas.database.id, databaseId),
with: {
project: true,
- alertPolicies: true
+ alertPolicies: true,
+ storagePolicies: true
}
});
@@ -42,55 +44,56 @@ export const uploadBackupAction = userAction
const arrayBuffer = await file.arrayBuffer();
- const fileSize = file.size;
const uuid = uuidv4();
- const fileName = `imported_${uuid}${fileExtension}`;
+ const fileName = `${uuid}${fileExtension}`;
const buffer = Buffer.from(arrayBuffer);
- const [settings] = await db.select().from(drizzleDb.schemas.setting).where(eq(drizzleDb.schemas.setting.name, "system")).limit(1);
-
- if (!settings) {
- return {
- success: false,
- actionError: {
- message: "Settings not set",
- status: 500,
- cause: "Unknown error",
- },
- };
- }
-
- let success: boolean, message: string, filePath: string;
-
- const result =
- settings.storage === "local"
- ? await uploadLocalPrivate(fileName, buffer)
- : await uploadS3Private(`${database.project?.slug}/${fileName}`, buffer, env.S3_BUCKET_NAME!);
-
- ({success, message, filePath} = result);
-
- if (!success) {
- return {
- success: false,
- actionError: {
- message: "An error has occurred while uploading file",
- status: 500,
- cause: "Unknown error",
- },
- };
- }
+ // const [settings] = await db.select().from(drizzleDb.schemas.setting).where(eq(drizzleDb.schemas.setting.name, "system")).limit(1);
+ //
+ // if (!settings) {
+ // return {
+ // success: false,
+ // actionError: {
+ // message: "Settings not set",
+ // status: 500,
+ // cause: "Unknown error",
+ // },
+ // };
+ // }
const [backup] = await db
.insert(drizzleDb.schemas.backup)
.values({
- status: 'success',
+ imported: true,
+ status: 'ongoing',
databaseId: database.id,
- file: fileName,
- fileSize: fileSize,
})
.returning();
+ await storeBackupFiles(backup, database, buffer, fileName)
+
+
+ // let success: boolean, message: string, filePath: string;
+ //
+ // const result =
+ // settings.storage === "local"
+ // ? await uploadLocalPrivate(fileName, buffer)
+ // : await uploadS3Private(`${database.project?.slug}/${fileName}`, buffer, env.S3_BUCKET_NAME!);
+ //
+ // ({success, message, filePath} = result);
+ //
+ // if (!success) {
+ // return {
+ // success: false,
+ // actionError: {
+ // message: "An error has occurred while uploading file",
+ // status: 500,
+ // cause: "Unknown error",
+ // },
+ // };
+ // }
+
return {
success: true,
value: backup,
diff --git a/src/components/wrappers/dashboard/profile2/button-delete-account/button-delete-account.tsx b/src/components/wrappers/dashboard/profile2/button-delete-account/button-delete-account.tsx
deleted file mode 100644
index 852ba1a9..00000000
--- a/src/components/wrappers/dashboard/profile2/button-delete-account/button-delete-account.tsx
+++ /dev/null
@@ -1,61 +0,0 @@
-"use client";
-
-import {useMutation} from "@tanstack/react-query";
-import {Trash2} from "lucide-react";
-import {ButtonWithConfirm} from "@/components/wrappers/common/button/button-with-confirm";
-import {signOut} from "@/lib/auth/auth-client";
-import {useRouter} from "next/navigation";
-import {deleteUserAction} from "./delete-account.action";
-
-export type ButtonDeleteAccountProps = {
- text?: string;
-};
-
-export const ButtonDeleteAccount = (props: ButtonDeleteAccountProps) => {
- const router = useRouter();
-
- const mutation = useMutation({
- mutationFn: () => deleteUserAction(""),
- onSuccess: async () => {
- await signOut({
- fetchOptions: {
- onSuccess: () => {
- router.push("/login");
- },
- },
- });
- },
- });
-
- return (
- ,
- },
- confirm: {
- className: "w-full",
- text: "Delete",
- icon: ,
- variant: "destructive",
- onClick: () => {
- mutation.mutate();
- },
- },
- cancel: {
- className: "w-full",
- text: "Cancel",
- icon: ,
- variant: "outline",
- },
- }}
- isPending={mutation.isPending}
- />
-
-
- );
-};
\ No newline at end of file
diff --git a/src/components/wrappers/dashboard/profile2/button-delete-account/delete-account.action.ts b/src/components/wrappers/dashboard/profile2/button-delete-account/delete-account.action.ts
deleted file mode 100644
index a9214f0f..00000000
--- a/src/components/wrappers/dashboard/profile2/button-delete-account/delete-account.action.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-"use server";
-import {userAction} from "@/lib/safe-actions/actions";
-import { z } from "zod";
-import { v4 as uuidv4 } from "uuid";
-import { db } from "@/db";
-import { eq } from "drizzle-orm";
-import * as drizzleDb from "@/db";
-import {authClient} from "@/lib/auth/auth-client";
-import {auth} from "@/lib/auth/auth";
-
-
-export const deleteUserAction = userAction.schema(z.string()).action(async ({ parsedInput, ctx }) => {
- const userId = parsedInput.length > 0 ? parsedInput : ctx.user.id;
- const uuid = uuidv4();
-
-
- // const [updatedUser] = await db
- // .update(drizzleDb.schemas.user)
- // .set({
- // email: `${uuid}@portabase.com`,
- // name: `${uuid}`,
- // //deleted: true,
- // //todo: add deleted
- // })
- // .where(eq(drizzleDb.schemas.user.id, userId))
- // .returning();
- const [deletedUser] = await db
- .delete(drizzleDb.schemas.user)
- .where(eq(drizzleDb.schemas.user.id, userId))
- .returning();
-
-
- return {
- data: deletedUser,
- };
-});
\ No newline at end of file
diff --git a/src/components/wrappers/dashboard/profile2/user-form/user-form.action.ts b/src/components/wrappers/dashboard/profile2/user-form/user-form.action.ts
deleted file mode 100644
index ee1da954..00000000
--- a/src/components/wrappers/dashboard/profile2/user-form/user-form.action.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-"use server";
-import {userAction} from "@/lib/safe-actions/actions";
-import { z } from "zod";
-import { UserSchema } from "@/components/wrappers/dashboard/profile2/user-form/user-form.schema";
-import { db } from "@/db";
-import { eq } from "drizzle-orm";
-import * as drizzleDb from "@/db";
-import {revokeSession, unlinkAccount} from "@/lib/auth/auth";
-import {withUpdatedAt} from "@/db/utils";
-
-export const updateUserAction = userAction
- .schema(
- z.object({
- id: z.string(),
- data: UserSchema,
- })
- )
- .action(async ({ parsedInput }) => {
- const [updatedUser] = await db.update(drizzleDb.schemas.user).set(withUpdatedAt(parsedInput.data)).where(eq(drizzleDb.schemas.user.id, parsedInput.id)).returning();
- return {
- data: updatedUser,
- };
- });
-
-
-export const deleteUserSessionAction = userAction.schema(z.string()).action(async ({ parsedInput }) => {
- const status = await revokeSession(parsedInput);
- return status;
-});
-
-
-export const unlinkUserProviderAction = userAction
- .schema(
- z.object({
- provider: z.string(),
- account: z.string(),
- })
- )
- .action(async ({ parsedInput }) => {
- const status = await unlinkAccount(parsedInput.provider, parsedInput.account);
-
- return status;
- });
diff --git a/src/components/wrappers/dashboard/profile2/user-form/user-form.schema.ts b/src/components/wrappers/dashboard/profile2/user-form/user-form.schema.ts
deleted file mode 100644
index 082be886..00000000
--- a/src/components/wrappers/dashboard/profile2/user-form/user-form.schema.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import {z} from "zod";
-
-export const UserSchema = z.object({
- name: z.string().optional(),
- email: z.string().optional(),
- role: z.string().optional(),
-});
-
-export type UserType = z.infer;
diff --git a/src/db/migrations/0027_special_the_santerians.sql b/src/db/migrations/0027_special_the_santerians.sql
new file mode 100644
index 00000000..50a13433
--- /dev/null
+++ b/src/db/migrations/0027_special_the_santerians.sql
@@ -0,0 +1 @@
+ALTER TABLE "backups" ADD COLUMN "imported" boolean DEFAULT false;
\ No newline at end of file
diff --git a/src/db/migrations/meta/0027_snapshot.json b/src/db/migrations/meta/0027_snapshot.json
new file mode 100644
index 00000000..a6d0a020
--- /dev/null
+++ b/src/db/migrations/meta/0027_snapshot.json
@@ -0,0 +1,2344 @@
+{
+ "id": "5db47099-e931-4eaa-8678-d3314a8336ca",
+ "prevId": "5d244170-557d-433b-8acd-742ead8246c8",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.settings": {
+ "name": "settings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "storage": {
+ "name": "storage",
+ "type": "type_storage",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'local'"
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "s3_endpoint_url": {
+ "name": "s3_endpoint_url",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_access_key_id": {
+ "name": "s3_access_key_id",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_secret_access_key": {
+ "name": "s3_secret_access_key",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "s3_bucket_name": {
+ "name": "s3_bucket_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "smtp_password": {
+ "name": "smtp_password",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "smtp_from": {
+ "name": "smtp_from",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "smtp_host": {
+ "name": "smtp_host",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "smtp_port": {
+ "name": "smtp_port",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "smtp_user": {
+ "name": "smtp_user",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "default_storage_channel_id": {
+ "name": "default_storage_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "settings_default_storage_channel_id_storage_channel_id_fk": {
+ "name": "settings_default_storage_channel_id_storage_channel_id_fk",
+ "tableFrom": "settings",
+ "tableTo": "storage_channel",
+ "columnsFrom": [
+ "default_storage_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "settings_name_unique": {
+ "name": "settings_name_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "name"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.account": {
+ "name": "account",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "account_id": {
+ "name": "account_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_id": {
+ "name": "provider_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "access_token_expires_at": {
+ "name": "access_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "refresh_token_expires_at": {
+ "name": "refresh_token_expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "account_user_id_user_id_fk": {
+ "name": "account_user_id_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.passkey": {
+ "name": "passkey",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "publicKey": {
+ "name": "publicKey",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "userId": {
+ "name": "userId",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "credentialId": {
+ "name": "credentialId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "counter": {
+ "name": "counter",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "deviceType": {
+ "name": "deviceType",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backedUp": {
+ "name": "backedUp",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "transports": {
+ "name": "transports",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "passkey_userId_user_id_fk": {
+ "name": "passkey_userId_user_id_fk",
+ "tableFrom": "passkey",
+ "tableTo": "user",
+ "columnsFrom": [
+ "userId"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.session": {
+ "name": "session",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ip_address": {
+ "name": "ip_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_agent": {
+ "name": "user_agent",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "impersonated_by": {
+ "name": "impersonated_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "session_user_id_user_id_fk": {
+ "name": "session_user_id_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "session_token_unique": {
+ "name": "session_token_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "token"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.two_factor": {
+ "name": "two_factor",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "secret": {
+ "name": "secret",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "backup_codes": {
+ "name": "backup_codes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "two_factor_user_id_user_id_fk": {
+ "name": "two_factor_user_id_user_id_fk",
+ "tableFrom": "two_factor",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user": {
+ "name": "user",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email_verified": {
+ "name": "email_verified",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "theme": {
+ "name": "theme",
+ "type": "user_themes",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'light'"
+ },
+ "banned": {
+ "name": "banned",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ban_reason": {
+ "name": "ban_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ban_expires": {
+ "name": "ban_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lastChangedPasswordAt": {
+ "name": "lastChangedPasswordAt",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "two_factor_enabled": {
+ "name": "two_factor_enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "user_email_unique": {
+ "name": "user_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.verification": {
+ "name": "verification",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization": {
+ "name": "organization",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "logo": {
+ "name": "logo",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "metadata": {
+ "name": "metadata",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_slug_unique": {
+ "name": "organization_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.member": {
+ "name": "member",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "member_organization_id_organization_id_fk": {
+ "name": "member_organization_id_organization_id_fk",
+ "tableFrom": "member",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "member_user_id_user_id_fk": {
+ "name": "member_user_id_user_id_fk",
+ "tableFrom": "member",
+ "tableTo": "user",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.invitation": {
+ "name": "invitation",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "invitation_organization_id_organization_id_fk": {
+ "name": "invitation_organization_id_organization_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "invitation_inviter_id_user_id_fk": {
+ "name": "invitation_inviter_id_user_id_fk",
+ "tableFrom": "invitation",
+ "tableTo": "user",
+ "columnsFrom": [
+ "inviter_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.projects": {
+ "name": "projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_archived": {
+ "name": "is_archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "projects_organization_id_organization_id_fk": {
+ "name": "projects_organization_id_organization_id_fk",
+ "tableFrom": "projects",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "projects_slug_unique": {
+ "name": "projects_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.backups": {
+ "name": "backups",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "status": {
+ "name": "status",
+ "type": "status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'waiting'"
+ },
+ "file": {
+ "name": "file",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "database_id": {
+ "name": "database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "imported": {
+ "name": "imported",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "backups_database_id_databases_id_fk": {
+ "name": "backups_database_id_databases_id_fk",
+ "tableFrom": "backups",
+ "tableTo": "databases",
+ "columnsFrom": [
+ "database_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.databases": {
+ "name": "databases",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "agent_database_id": {
+ "name": "agent_database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "dbms": {
+ "name": "dbms",
+ "type": "dbms_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backup_policy": {
+ "name": "backup_policy",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_waiting_for_backup": {
+ "name": "is_waiting_for_backup",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "backup_to_restore": {
+ "name": "backup_to_restore",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "agent_id": {
+ "name": "agent_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "last_contact": {
+ "name": "last_contact",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "databases_agent_id_agents_id_fk": {
+ "name": "databases_agent_id_agents_id_fk",
+ "tableFrom": "databases",
+ "tableTo": "agents",
+ "columnsFrom": [
+ "agent_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "databases_project_id_projects_id_fk": {
+ "name": "databases_project_id_projects_id_fk",
+ "tableFrom": "databases",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.restorations": {
+ "name": "restorations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "status": {
+ "name": "status",
+ "type": "status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'waiting'"
+ },
+ "backup_storage_id": {
+ "name": "backup_storage_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "backup_id": {
+ "name": "backup_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "database_id": {
+ "name": "database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "restorations_backup_storage_id_backup_storage_id_fk": {
+ "name": "restorations_backup_storage_id_backup_storage_id_fk",
+ "tableFrom": "restorations",
+ "tableTo": "backup_storage",
+ "columnsFrom": [
+ "backup_storage_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "restorations_backup_id_backups_id_fk": {
+ "name": "restorations_backup_id_backups_id_fk",
+ "tableFrom": "restorations",
+ "tableTo": "backups",
+ "columnsFrom": [
+ "backup_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "restorations_database_id_databases_id_fk": {
+ "name": "restorations_database_id_databases_id_fk",
+ "tableFrom": "restorations",
+ "tableTo": "databases",
+ "columnsFrom": [
+ "database_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.retention_policies": {
+ "name": "retention_policies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "database_id": {
+ "name": "database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "retention_policy_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "count": {
+ "name": "count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 7
+ },
+ "days": {
+ "name": "days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 30
+ },
+ "gfs_daily": {
+ "name": "gfs_daily",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 7
+ },
+ "gfs_weekly": {
+ "name": "gfs_weekly",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 4
+ },
+ "gfs_monthly": {
+ "name": "gfs_monthly",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 12
+ },
+ "gfs_yearly": {
+ "name": "gfs_yearly",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 3
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "retention_policies_database_id_databases_id_fk": {
+ "name": "retention_policies_database_id_databases_id_fk",
+ "tableFrom": "retention_policies",
+ "tableTo": "databases",
+ "columnsFrom": [
+ "database_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.agents": {
+ "name": "agents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "slug": {
+ "name": "slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "version": {
+ "name": "version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_archived": {
+ "name": "is_archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "last_contact": {
+ "name": "last_contact",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "agents_slug_unique": {
+ "name": "agents_slug_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "slug"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification_channel": {
+ "name": "notification_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "provider": {
+ "name": "provider",
+ "type": "provider_kind",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "notification_channel_organization_id_organization_id_fk": {
+ "name": "notification_channel_organization_id_organization_id_fk",
+ "tableFrom": "notification_channel",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_notification_channels": {
+ "name": "organization_notification_channels",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "notification_channel_id": {
+ "name": "notification_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_notification_channels_organization_id_organization_id_fk": {
+ "name": "organization_notification_channels_organization_id_organization_id_fk",
+ "tableFrom": "organization_notification_channels",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_notification_channels_notification_channel_id_notification_channel_id_fk": {
+ "name": "organization_notification_channels_notification_channel_id_notification_channel_id_fk",
+ "tableFrom": "organization_notification_channels",
+ "tableTo": "notification_channel",
+ "columnsFrom": [
+ "notification_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_notification_channels_organization_id_notification_channel_id_unique": {
+ "name": "organization_notification_channels_organization_id_notification_channel_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "notification_channel_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.alert_policy": {
+ "name": "alert_policy",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "notification_channel_id": {
+ "name": "notification_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "event_kind": {
+ "name": "event_kind",
+ "type": "event_kind[]",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "database_id": {
+ "name": "database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "alert_policy_notification_channel_id_notification_channel_id_fk": {
+ "name": "alert_policy_notification_channel_id_notification_channel_id_fk",
+ "tableFrom": "alert_policy",
+ "tableTo": "notification_channel",
+ "columnsFrom": [
+ "notification_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "alert_policy_database_id_databases_id_fk": {
+ "name": "alert_policy_database_id_databases_id_fk",
+ "tableFrom": "alert_policy",
+ "tableTo": "databases",
+ "columnsFrom": [
+ "database_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.notification_log": {
+ "name": "notification_log",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "channel_id": {
+ "name": "channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "policy_id": {
+ "name": "policy_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "event": {
+ "name": "event",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "provider_name": {
+ "name": "provider_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "message": {
+ "name": "message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "level": {
+ "name": "level",
+ "type": "level",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payload": {
+ "name": "payload",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "success": {
+ "name": "success",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "error": {
+ "name": "error",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider_response": {
+ "name": "provider_response",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_at": {
+ "name": "sent_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.organization_storage_channels": {
+ "name": "organization_storage_channels",
+ "schema": "",
+ "columns": {
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_channel_id": {
+ "name": "storage_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_storage_channels_organization_id_organization_id_fk": {
+ "name": "organization_storage_channels_organization_id_organization_id_fk",
+ "tableFrom": "organization_storage_channels",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "organization_storage_channels_storage_channel_id_storage_channel_id_fk": {
+ "name": "organization_storage_channels_storage_channel_id_storage_channel_id_fk",
+ "tableFrom": "organization_storage_channels",
+ "tableTo": "storage_channel",
+ "columnsFrom": [
+ "storage_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "organization_storage_channels_organization_id_storage_channel_id_unique": {
+ "name": "organization_storage_channels_organization_id_storage_channel_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "organization_id",
+ "storage_channel_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.storage_channel": {
+ "name": "storage_channel",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "provider_storage_kind",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "config": {
+ "name": "config",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "storage_channel_organization_id_organization_id_fk": {
+ "name": "storage_channel_organization_id_organization_id_fk",
+ "tableFrom": "storage_channel",
+ "tableTo": "organization",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.storage_policy": {
+ "name": "storage_policy",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "storage_channel_id": {
+ "name": "storage_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "enabled": {
+ "name": "enabled",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "database_id": {
+ "name": "database_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "storage_policy_storage_channel_id_storage_channel_id_fk": {
+ "name": "storage_policy_storage_channel_id_storage_channel_id_fk",
+ "tableFrom": "storage_policy",
+ "tableTo": "storage_channel",
+ "columnsFrom": [
+ "storage_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "storage_policy_database_id_databases_id_fk": {
+ "name": "storage_policy_database_id_databases_id_fk",
+ "tableFrom": "storage_policy",
+ "tableTo": "databases",
+ "columnsFrom": [
+ "database_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.backup_storage": {
+ "name": "backup_storage",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "backup_id": {
+ "name": "backup_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "storage_channel_id": {
+ "name": "storage_channel_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "backup_storage_status",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'pending'"
+ },
+ "path": {
+ "name": "path",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "size": {
+ "name": "size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "checksum": {
+ "name": "checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "deleted_at": {
+ "name": "deleted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "backup_storage_backup_id_backups_id_fk": {
+ "name": "backup_storage_backup_id_backups_id_fk",
+ "tableFrom": "backup_storage",
+ "tableTo": "backups",
+ "columnsFrom": [
+ "backup_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "backup_storage_storage_channel_id_storage_channel_id_fk": {
+ "name": "backup_storage_storage_channel_id_storage_channel_id_fk",
+ "tableFrom": "backup_storage",
+ "tableTo": "storage_channel",
+ "columnsFrom": [
+ "storage_channel_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.user_themes": {
+ "name": "user_themes",
+ "schema": "public",
+ "values": [
+ "light",
+ "dark",
+ "system"
+ ]
+ },
+ "public.retention_policy_type": {
+ "name": "retention_policy_type",
+ "schema": "public",
+ "values": [
+ "count",
+ "days",
+ "gfs"
+ ]
+ },
+ "public.provider_kind": {
+ "name": "provider_kind",
+ "schema": "public",
+ "values": [
+ "slack",
+ "smtp",
+ "discord",
+ "telegram",
+ "gotify",
+ "ntfy",
+ "webhook"
+ ]
+ },
+ "public.event_kind": {
+ "name": "event_kind",
+ "schema": "public",
+ "values": [
+ "error_backup",
+ "error_restore",
+ "success_restore",
+ "success_backup",
+ "weekly_report"
+ ]
+ },
+ "public.level": {
+ "name": "level",
+ "schema": "public",
+ "values": [
+ "critical",
+ "warning",
+ "info"
+ ]
+ },
+ "public.provider_storage_kind": {
+ "name": "provider_storage_kind",
+ "schema": "public",
+ "values": [
+ "local",
+ "s3"
+ ]
+ },
+ "public.backup_storage_status": {
+ "name": "backup_storage_status",
+ "schema": "public",
+ "values": [
+ "pending",
+ "success",
+ "failed"
+ ]
+ },
+ "public.dbms_status": {
+ "name": "dbms_status",
+ "schema": "public",
+ "values": [
+ "postgresql",
+ "mysql"
+ ]
+ },
+ "public.status": {
+ "name": "status",
+ "schema": "public",
+ "values": [
+ "waiting",
+ "ongoing",
+ "failed",
+ "success"
+ ]
+ },
+ "public.type_storage": {
+ "name": "type_storage",
+ "schema": "public",
+ "values": [
+ "local",
+ "s3"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {},
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+}
\ No newline at end of file
diff --git a/src/db/migrations/meta/_journal.json b/src/db/migrations/meta/_journal.json
index 35fe3740..7961fc0b 100644
--- a/src/db/migrations/meta/_journal.json
+++ b/src/db/migrations/meta/_journal.json
@@ -190,6 +190,13 @@
"when": 1768665081232,
"tag": "0026_demonic_santa_claus",
"breakpoints": true
+ },
+ {
+ "idx": 27,
+ "version": "7",
+ "when": 1768676733859,
+ "tag": "0027_special_the_santerians",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/src/db/schema/07_database.ts b/src/db/schema/07_database.ts
index 73966b5a..bdc3ef7c 100644
--- a/src/db/schema/07_database.ts
+++ b/src/db/schema/07_database.ts
@@ -41,6 +41,7 @@ export const backup = pgTable(
databaseId: uuid("database_id")
.notNull()
.references(() => database.id, {onDelete: "cascade"}),
+ imported: boolean('imported').default(false),
...timestamps
},
);
diff --git a/src/features/dashboard/backup/columns.tsx b/src/features/dashboard/backup/columns.tsx
index 133f5255..8422e6d6 100644
--- a/src/features/dashboard/backup/columns.tsx
+++ b/src/features/dashboard/backup/columns.tsx
@@ -66,9 +66,8 @@ export function backupColumns(
accessorKey: "id",
header: "Reference",
cell: ({row}) => {
- const fileName = row.original.file
const reference = row.original.id
- const isImported = isImportedFilename(`${fileName}`)
+ const isImported = row.original.imported
return isImported ? `${reference} (imported)` : `${reference}`
},
},