--- name: db_create_table kind: function lang: go domain: infra version: "1.0.0" purity: impure signature: "func DBCreateTable(db *sql.DB, table string, columns []string) error" description: "Ejecuta CREATE TABLE IF NOT EXISTS con las definiciones de columnas dadas. Valida que el nombre de tabla sea un identificador SQL seguro." tags: [database, sql, ddl, create, table, schema] uses_functions: [] uses_types: [] returns: [] returns_optional: false error_type: "error_go_core" imports: ["database/sql", "regexp", "strings"] tested: false tests: [] test_file_path: "" file_path: "functions/infra/db_create_table.go" --- ## Ejemplo ```go err := DBCreateTable(db, "events", []string{ "id INTEGER PRIMARY KEY AUTOINCREMENT", "name TEXT NOT NULL", "ts INTEGER NOT NULL", "payload TEXT", }) ``` ## Notas `columns` son definiciones SQL completas incluyendo nombre, tipo y constraints. Usa `CREATE TABLE IF NOT EXISTS` para ser idempotente. Valida el nombre de tabla con regex `^[a-zA-Z_][a-zA-Z0-9_]*$` para prevenir SQL injection. Las definiciones de columna no se sanitizan — son responsabilidad del llamador.