feat: structure candidate SQL table data as columns/rows

- Replace literal setupSql strings with structured columns/rows model
- Add SqlColumn interface and updated SqlTablePreset with columns/rows arrays
- Implement toSqlLiteral() for value escaping and buildSetupSql() for SQL generation
- Update sqlTable.ts to call buildSetupSql() instead of accessing setupSql field
- Maintains data parity with existing tables (students, employees, products)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 00:34:39 -06:00
parent 4abd5761a0
commit 9a01d0e972
2 changed files with 73 additions and 57 deletions

View File

@@ -1,5 +1,5 @@
import { ref } from "vue"
import { defaultSqlTableId, sqlTables } from "../data/sqlTables"
import { buildSetupSql, defaultSqlTableId, sqlTables } from "../data/sqlTables"
export const selectedTableId = ref(defaultSqlTableId)
@@ -12,5 +12,5 @@ export function buildSqlScript(studentSql: string) {
sqlTables.find((item) => item.id === selectedTableId.value) ??
sqlTables[0]
const normalizedSql = studentSql.trim().replace(/;?\s*$/, ";")
return `${table.setupSql}\n\n${normalizedSql}\n\nSELECT * FROM ${table.tableName};`
return `${buildSetupSql(table)}\n\n${normalizedSql}\n\nSELECT * FROM ${table.tableName};`
}