MCPcopy Index your code
hub / github.com/simstudioai/sim / validateTableName

Function validateTableName

apps/sim/lib/table/validation.ts:154–175  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

152
153/** Validates table name format and length. */
154export function validateTableName(name: string): ValidationResult {
155 const errors: string[] = []
156
157 if (!name || typeof name !== 'string') {
158 errors.push('Table name is required')
159 return { valid: false, errors }
160 }
161
162 if (name.length > TABLE_LIMITS.MAX_TABLE_NAME_LENGTH) {
163 errors.push(
164 `Table name exceeds maximum length (${TABLE_LIMITS.MAX_TABLE_NAME_LENGTH} characters)`
165 )
166 }
167
168 if (!NAME_PATTERN.test(name)) {
169 errors.push(
170 'Table name must start with letter or underscore, followed by alphanumeric or underscore'
171 )
172 }
173
174 return { valid: errors.length === 0, errors }
175}
176
177/** Validates table schema structure and column definitions. */
178export function validateTableSchema(schema: TableSchema): ValidationResult {

Callers 3

createTableFunction · 0.90
renameTableFunction · 0.90
validation.test.tsFile · 0.90

Calls 2

testMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected