From caf160156729788330e23b8dfaccb65cf6242456 Mon Sep 17 00:00:00 2001 From: "me@rodrigorodriguez.com" Date: Thu, 17 Oct 2024 14:40:32 -0300 Subject: [PATCH] new(core.gbapp): LLM alerts for data. --- packages/basic.gblib/services/SystemKeywords.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/basic.gblib/services/SystemKeywords.ts b/packages/basic.gblib/services/SystemKeywords.ts index b079f70b..e553d525 100644 --- a/packages/basic.gblib/services/SystemKeywords.ts +++ b/packages/basic.gblib/services/SystemKeywords.ts @@ -2955,7 +2955,17 @@ export class SystemKeywords { const schema = {}; Object.keys(columns).forEach(col => { const columnType = columns[col].type; - schema[col] = mapToSQLiteType(columnType); // Map source type to SQLite type + + // Map source type to SQLite type + schema[col] = { + type: mapToSQLiteType(columnType) + }; + + // If the column is named 'id' or 'Id', set it as the primary key + if (col.toLowerCase() === 'id') { + schema[col].primaryKey = true; + schema[col].autoIncrement = true; // Optional: auto-increment for primary key + } }); // Define the model dynamically for each table in SQLite