Skip to content

Commit 65f30da

Browse files
authored
Merge pull request #421 from timbornemann/codex/erweitere-tabellenvorschau-um-alle-attribute
Fix database explorer preview columns
2 parents 1077cbb + a711728 commit 65f30da

2 files changed

Lines changed: 14 additions & 16 deletions

File tree

server/controllers/database.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,14 @@ function tableExists(table: string): boolean {
4242
function getTableColumns(table: string): ColumnInfo[] {
4343
try {
4444
const rows = db
45-
.prepare(
46-
"SELECT name, type, notnull, pk, dflt_value FROM pragma_table_info(?)",
47-
)
48-
.all(table) as Array<{
49-
name: string;
50-
type: string;
51-
notnull: number;
52-
pk: number;
53-
dflt_value: string | null;
45+
.prepare(`PRAGMA table_info(${table})`)
46+
.all() as Array<{
47+
cid: number;
48+
name: string;
49+
type: string;
50+
notnull: number;
51+
pk: number;
52+
dflt_value: string | null;
5453
}>;
5554
return rows.map((col) => ({
5655
name: col.name,

src/components/DatabaseExplorer.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
TableHeader,
2424
TableRow,
2525
} from "@/components/ui/table";
26-
import { ScrollArea } from "@/components/ui/scroll-area";
2726
import { Textarea } from "@/components/ui/textarea";
2827
import {
2928
Dialog,
@@ -312,8 +311,8 @@ const DatabaseExplorer: React.FC = () => {
312311
}
313312
const headers = Object.keys(queryResult.rows[0] || {});
314313
return (
315-
<ScrollArea className="max-h-72 w-full">
316-
<div className="min-w-full">
314+
<div className="max-h-72 w-full overflow-auto">
315+
<div className="min-w-max">
317316
<Table>
318317
<TableHeader>
319318
<TableRow>
@@ -335,7 +334,7 @@ const DatabaseExplorer: React.FC = () => {
335334
</TableBody>
336335
</Table>
337336
</div>
338-
</ScrollArea>
337+
</div>
339338
);
340339
};
341340

@@ -448,8 +447,8 @@ const DatabaseExplorer: React.FC = () => {
448447
{t("settingsPage.database.loading")}
449448
</div>
450449
) : tableData && tableData.rows.length ? (
451-
<ScrollArea className="max-h-[480px] w-full">
452-
<div className="min-w-full">
450+
<div className="max-h-[480px] w-full overflow-auto">
451+
<div className="min-w-max">
453452
<Table>
454453
<TableHeader>
455454
<TableRow>
@@ -498,7 +497,7 @@ const DatabaseExplorer: React.FC = () => {
498497
</TableBody>
499498
</Table>
500499
</div>
501-
</ScrollArea>
500+
</div>
502501
) : (
503502
<p className="text-sm text-muted-foreground">
504503
{t("settingsPage.database.noRows")}

0 commit comments

Comments
 (0)