mirror of
https://github.com/chartdb/chartdb.git
synced 2025-11-05 06:23:17 +00:00
fix multi select type combobox and scroll issues on mobile
This commit is contained in:
@@ -3,6 +3,8 @@ import { createOpenAI } from '@ai-sdk/openai';
|
||||
import { Diagram } from '../../domain/diagram';
|
||||
import { OPENAI_API_KEY } from '@/lib/env';
|
||||
import { DatabaseType } from '@/lib/domain/database-type';
|
||||
import { DBTable } from '@/lib/domain/db-table';
|
||||
import { DataType } from '../data-types';
|
||||
|
||||
const openai = createOpenAI({
|
||||
apiKey: OPENAI_API_KEY,
|
||||
@@ -29,7 +31,7 @@ export const exportBaseSQL = (diagram: Diagram): string => {
|
||||
sqlScript += `CREATE TABLE ${table.name} (\n`;
|
||||
|
||||
table.fields.forEach((field, index) => {
|
||||
sqlScript += ` ${field.name} ${field.type}`;
|
||||
sqlScript += ` ${field.name} ${field.type.name}`;
|
||||
|
||||
// Add size for character types
|
||||
if (field.characterMaximumLength) {
|
||||
@@ -128,7 +130,7 @@ export const exportSQL = async (
|
||||
return text;
|
||||
};
|
||||
|
||||
function getMySQLDataTypeSize(type: string) {
|
||||
function getMySQLDataTypeSize(type: DataType) {
|
||||
return (
|
||||
{
|
||||
tinyint: 1,
|
||||
@@ -141,7 +143,7 @@ function getMySQLDataTypeSize(type: string) {
|
||||
decimal: 16,
|
||||
numeric: 16,
|
||||
// Add other relevant data types if needed
|
||||
}[type.toLowerCase()] || 0
|
||||
}[type.name.toLowerCase()] || 0
|
||||
);
|
||||
}
|
||||
|
||||
@@ -158,7 +160,7 @@ function alignForeignKeyDataTypes(diagram: Diagram) {
|
||||
}
|
||||
|
||||
// Convert tables to a map for quick lookup
|
||||
const tableMap = new Map();
|
||||
const tableMap = new Map<string, DBTable>();
|
||||
tables.forEach((table) => {
|
||||
tableMap.set(table.id, table);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user