Skip to content

Commit

Permalink
fix: make nullable as default when alter table (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
yfractal authored Nov 21, 2022
1 parent 663c725 commit 5428ad3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sql/src/statements.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5428ad3

Please sign in to comment.