fix multi select type combobox and scroll issues on mobile

This commit is contained in:
Guy Ben-Aharon
2024-08-28 22:21:03 +03:00
parent 15be8f0414
commit bb6c3419b6
13 changed files with 623 additions and 432 deletions

View File

@@ -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);
});