Block timeOnly changes in the api

This commit is contained in:
Adria Navarro 2024-05-22 17:18:58 +02:00
parent 2cc329994a
commit b3bea1e839
1 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,16 @@ function validate(table: Table, oldTable?: Table) {
`Column "${key}" has subtype "${column.subtype}" - this is not supported.`
)
}
if (column.type === FieldType.DATETIME) {
const oldColumn = oldTable?.schema[key] as typeof column
if (column.timeOnly !== oldColumn.timeOnly) {
throw new Error(
`Column "${key}" can not change from time to datetime or viceversa.`
)
}
}
}
}