validate same field types when connecting

This commit is contained in:
Guy Ben-Aharon
2024-08-23 01:00:15 +03:00
parent c564df6e07
commit 90c5d58970
8 changed files with 445 additions and 19 deletions

View File

@@ -140,7 +140,10 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
{
id: generateId(),
name: 'id',
type: 'bigint',
type:
databaseType === DatabaseType.SQLITE
? 'integer'
: 'bigint',
unique: true,
nullable: false,
primaryKey: true,
@@ -155,7 +158,7 @@ export const ChartDBProvider: React.FC<React.PropsWithChildren> = ({
await addTable(table);
return table;
}, [addTable, tables]);
}, [addTable, tables, databaseType]);
const getTable: ChartDBContext['getTable'] = useCallback(
(id: string) => tables.find((table) => table.id === id) ?? null,