mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
* feat: working on migration backup tool * feat: add migration sequences * fix: responsive for migration tool * fix: truncate database name in migration * fix: filter on databases success for migration tool --------- Co-authored-by: charles-gauthereau <charles.gauthereau@soluce-technologies.com>
65 lines
2.1 KiB
TypeScript
65 lines
2.1 KiB
TypeScript
import {PageParams} from "@/types/next";
|
|
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
|
import {notFound} from "next/navigation";
|
|
import {getOrganization} from "@/lib/auth/auth";
|
|
import {Metadata} from "next";
|
|
import {db} from "@/db";
|
|
import {MigrationTool} from "@/components/wrappers/dashboard/organization/migration/migration-tool";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Projects",
|
|
};
|
|
|
|
export default async function RoutePage(props: PageParams<{}>) {
|
|
|
|
const organization = await getOrganization({});
|
|
|
|
if (!organization) {
|
|
notFound();
|
|
}
|
|
|
|
const projects = await db.query.project.findMany({
|
|
where: (project, {eq, and, not}) =>
|
|
and(
|
|
eq(project.organizationId, organization.id),
|
|
not(eq(project.isArchived, true))
|
|
),
|
|
with: {
|
|
organization: true,
|
|
databases: {
|
|
where: (database, { isNull, not, inArray, and }) =>
|
|
and(
|
|
isNull(database.deletedAt),
|
|
not(inArray(database.dbms, ["valkey", "redis"]))
|
|
),
|
|
|
|
with: {
|
|
backups: {
|
|
where: (backup, { isNull, eq, and }) =>
|
|
and(
|
|
isNull(backup.deletedAt),
|
|
eq(backup.status, "success")
|
|
),
|
|
orderBy: (backup, {desc}) => [desc(backup.createdAt)],
|
|
limit: 15,
|
|
}
|
|
}
|
|
},
|
|
},
|
|
});
|
|
return (
|
|
<Page>
|
|
<PageHeader className="flex flex-col items-start justify-between mb-6">
|
|
<PageTitle className="mb-2">
|
|
Database Migration
|
|
</PageTitle>
|
|
<p className="text-sm text-muted-foreground">
|
|
Import backups from a source project into your target database
|
|
</p>
|
|
</PageHeader>
|
|
<PageContent>
|
|
<MigrationTool projects={projects}/>
|
|
</PageContent>
|
|
</Page>
|
|
);
|
|
} |