diff --git a/app/tables/[database]/[table]/alternative-tables.tsx b/app/tables/[database]/[table]/alternative-tables.tsx
new file mode 100644
index 00000000..94ac6df7
--- /dev/null
+++ b/app/tables/[database]/[table]/alternative-tables.tsx
@@ -0,0 +1,72 @@
+import Link from 'next/link'
+import { CardStackMinusIcon, DotFilledIcon } from '@radix-ui/react-icons'
+import { ChevronDownIcon, TableIcon } from 'lucide-react'
+
+import { fetchData } from '@/lib/clickhouse'
+import { Button } from '@/components/ui/button'
+import {
+ DropdownMenu,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuTrigger,
+} from '@/components/ui/dropdown-menu'
+
+interface AlternativeTablesProps {
+ database: string
+ table: string
+}
+
+export async function AlternativeTables({
+ database,
+ table,
+}: AlternativeTablesProps) {
+ let anotherTables: { name: string }[] = []
+ try {
+ anotherTables = await fetchData(
+ `SELECT name FROM system.tables WHERE database = {database: String}`,
+ { database }
+ )
+ } catch (error) {
+ console.log(error)
+
+ return null
+ }
+
+ return (
+
+
+
+
+
+
+ {anotherTables.map(({ name }) => (
+
+
+ {name == table ? (
+
+ ) : (
+
+ )}
+
+ {name}
+
+
+ ))}
+
+
+ )
+}
diff --git a/app/tables/[database]/[table]/page.tsx b/app/tables/[database]/[table]/page.tsx
index ad36feb3..5f404627 100644
--- a/app/tables/[database]/[table]/page.tsx
+++ b/app/tables/[database]/[table]/page.tsx
@@ -2,10 +2,14 @@ import Link from 'next/link'
import { ArrowLeftIcon } from 'lucide-react'
import { fetchData } from '@/lib/clickhouse'
-import type { QueryConfig } from '@/lib/types/query-config'
+import { type QueryConfig } from '@/lib/types/query-config'
+import { Button } from '@/components/ui/button'
import { ColumnFormat } from '@/components/data-table/columns'
import { DataTable } from '@/components/data-table/data-table'
+import { AlternativeTables } from './alternative-tables'
+import { ShowDDL } from './show-ddl-button'
+
const config: QueryConfig = {
name: 'columns',
sql: `
@@ -64,13 +68,21 @@ export default async function ColumnsPage({
return (
-
-
- Back to tables
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ SQL DDL Code
+
+ CREATE query used for creating this table
+
+
+
+
+
+ )
+}
diff --git a/components/ui/dialog.tsx b/components/ui/dialog.tsx
index 98b43bf6..8c356447 100644
--- a/components/ui/dialog.tsx
+++ b/components/ui/dialog.tsx
@@ -22,6 +22,7 @@ const DialogOverlay = React.forwardRef<
ref={ref}
className={cn(
'bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm',
+ 'grid place-items-center overflow-y-auto',
className
)}
{...props}
@@ -34,21 +35,23 @@ const DialogContent = React.forwardRef<
React.ComponentPropsWithoutRef
>(({ className, children, ...props }, ref) => (
-
-
- {children}
-
-
- Close
-
-
+
+
+ {children}
+
+
+ Close
+
+
+
))
DialogContent.displayName = DialogPrimitive.Content.displayName