fix: make nullable as default when alter table (#591)

This commit is contained in:
Mike Yang
2022-11-21 12:11:19 +08:00
committed by GitHub
parent 663c725838
commit 5428ad364e

View File

@@ -260,10 +260,11 @@ pub fn column_def_to_schema(column_def: &ColumnDef, is_time_index: bool) -> Resu
pub fn sql_column_def_to_grpc_column_def(col: ColumnDef) -> Result<api::v1::ColumnDef> {
let name = col.name.value.clone();
let data_type = sql_data_type_to_concrete_data_type(&col.data_type)?;
let nullable = col
let nullable = !col
.options
.iter()
.any(|o| matches!(o.option, ColumnOption::Null));
.any(|o| matches!(o.option, ColumnOption::NotNull));
let default_constraint = parse_column_default_constraint(&name, &data_type, &col.options)?
.map(ColumnDefaultConstraint::try_into) // serialize default constraint to bytes