godcrm/backend/services/system-tables-creator/helpers.js
GOD CRM Release f89e074dd1
Some checks failed
CI / Lint / Typecheck / Test / Build (push) Has been cancelled
CI / PostgreSQL Integration Tests (push) Has been cancelled
GOD CRM — public scrubbed snapshot
Governed substrate for autonomous agents: scoped identity (passports),
audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
2026-08-10 04:01:45 +03:00

29 lines
769 B
JavaScript

// system-tables-creator/helpers.js
// Shared helper for inserting table columns
import { dbRun, toBool } from '../../database/connection.js';
/**
* Insert columns for a table
* @param {number} tableId - Table ID
* @param {Array} columns - Column definitions
*/
export async function insertColumns(tableId, columns) {
for (const col of columns) {
await dbRun(`
INSERT INTO table_columns (
table_id, column_name, display_name, type, config,
order_index, is_required, is_system
) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
`, [
tableId,
col.name,
col.display,
col.type,
col.config ? JSON.stringify(col.config) : null,
col.order,
toBool(col.is_required),
toBool(col.is_system)
]);
}
}