Governed substrate for autonomous agents: scoped identity (passports), audited actions, MCP workspace. Infra IPs and secrets redacted for public release.
29 lines
769 B
JavaScript
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)
|
|
]);
|
|
}
|
|
}
|