mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-26 00:00:51 +00:00
19 lines
566 B
TypeScript
19 lines
566 B
TypeScript
import type { TreeNode } from "@/types/database";
|
|
import { sortSidebarNames } from "@/lib/databaseTree";
|
|
|
|
export const SQLSERVER_DEFAULT_SCHEMA = "dbo";
|
|
|
|
export function buildSqlServerDatabaseTreeNodes(connectionId: string, database: string, schemas: string[]): TreeNode[] {
|
|
const databaseNodeId = `${connectionId}:${database}`;
|
|
return sortSidebarNames(schemas).map((schema) => ({
|
|
id: `${databaseNodeId}:${schema}`,
|
|
label: schema,
|
|
type: "schema" as const,
|
|
connectionId,
|
|
database,
|
|
schema,
|
|
isExpanded: false,
|
|
children: [],
|
|
}));
|
|
}
|