From 8f01fc8a6f02050e4a8ec94b0613749b65517a49 Mon Sep 17 00:00:00 2001 From: fcarraUniSa Date: Tue, 23 Dec 2025 10:34:47 +0100 Subject: [PATCH] Update types.ts --- types.ts | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/types.ts b/types.ts index 220566a..82cff33 100644 --- a/types.ts +++ b/types.ts @@ -18,18 +18,37 @@ export interface ToastMessage { text: string; } -// Simple schema for n8n SQL generation +// Uniform schema for both Postgres and MySQL, showing the VARCHAR id needed for UUIDs export const SQL_SCHEMA = ` +-- Per MySQL CREATE TABLE IF NOT EXISTS email_templates ( - id INT AUTO_INCREMENT PRIMARY KEY, + id VARCHAR(255) PRIMARY KEY, template_key VARCHAR(255) UNIQUE NOT NULL, + name VARCHAR(255) NOT NULL, + description TEXT, subject VARCHAR(255), - header_html TEXT, - body_html TEXT, - footer_html TEXT, - full_html TEXT, + header_html MEDIUMTEXT, + body_html MEDIUMTEXT, + footer_html MEDIUMTEXT, + full_html MEDIUMTEXT, required_variables JSON, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ); -`; \ No newline at end of file + +-- Per PostgreSQL +-- CREATE TABLE IF NOT EXISTS email_templates ( +-- id VARCHAR(255) PRIMARY KEY, +-- template_key VARCHAR(255) UNIQUE NOT NULL, +-- name VARCHAR(255) NOT NULL, +-- description TEXT, +-- subject VARCHAR(255), +-- header_html TEXT, +-- body_html TEXT, +-- footer_html TEXT, +-- full_html TEXT, +-- required_variables JSONB, +-- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, +-- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +-- ); +`;