mirror of
https://github.com/dolthub/dolt.git
synced 2026-05-06 02:41:02 -05:00
Added a failsafe validation for schemas about to be written to disk.
This commit is contained in:
@@ -224,6 +224,13 @@ func (sd schemaData) decodeSchema() (schema.Schema, error) {
|
||||
|
||||
// MarshalSchemaAsNomsValue takes a Schema and converts it to a types.Value
|
||||
func MarshalSchemaAsNomsValue(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema) (types.Value, error) {
|
||||
// Anyone calling this is going to serialize this to disk, so it's our last line of defense against defective schemas.
|
||||
// Business logic should catch errors before this point, but this is a failsafe.
|
||||
err := schema.ValidateForInsert(sch.GetAllCols())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sd, err := toSchemaData(sch)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user