Skip to content

Commit

Permalink
set null by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Gleb Patsiia committed Jan 29, 2024
1 parent 5e2cc3d commit 2d1ab4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type attr = {name : string; domain : Type.t; extra : Constraints.t; }

let make_attribute name kind extra =
if Constraints.mem Null extra && Constraints.mem NotNull extra then fail "Column %s can be either NULL or NOT NULL, but not both" name;
let domain = Type.{ t = Option.default Int kind; nullability = if Constraints.mem Null extra then Nullable else Strict } in
let domain = Type.{ t = Option.default Int kind; nullability = if not @@ Constraints.mem NotNull extra then Nullable else Strict } in
{name;domain;extra}

let unnamed_attribute domain = {name="";domain;extra=Constraints.empty}
Expand Down

0 comments on commit 2d1ab4b

Please sign in to comment.