Files
myeasycms-v2/apps/dev-tool/app/database/_lib/server/table-server-actions.ts
Giancarlo Buomprisco 7ebff31475 Next.js Supabase V3 (#463)
Version 3 of the kit:
- Radix UI replaced with Base UI (using the Shadcn UI patterns)
- next-intl replaces react-i18next
- enhanceAction deprecated; usage moved to next-safe-action
- main layout now wrapped with [locale] path segment
- Teams only mode
- Layout updates
- Zod v4
- Next.js 16.2
- Typescript 6
- All other dependencies updated
- Removed deprecated Edge CSRF
- Dynamic Github Action runner
2026-03-24 13:40:38 +08:00

33 lines
747 B
TypeScript

'use server';
import { DatabaseTool } from '@kit/mcp-server/database';
import { relative } from 'path';
export async function getTableDetailsAction(
tableName: string,
schema = 'public',
) {
try {
DatabaseTool.ROOT_PATH = relative(process.cwd(), '../..');
console.log('Fetching table info for:', { tableName, schema });
const tableInfo = await DatabaseTool.getTableInfo(schema, tableName);
console.log('Successfully fetched table info:', tableInfo);
return {
success: true,
data: tableInfo,
};
} catch (error) {
console.error('Error fetching table info:', error);
return {
success: false,
error: `Failed to fetch table information: ${(error as Error).message}`,
};
}
}