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 +-- ); +`;