diff options
| author | Sébastien Dailly <sebastien@dailly.me> | 2026-11-21 12:22:50 +0100 |
|---|---|---|
| committer | Sébastien Dailly <sebastien@dailly.me> | 2026-11-21 12:22:50 +0100 |
| commit | bc78bea63b7c75e8a9d222dc86fb75ed293a2242 (patch) | |
| tree | 6c864df4d57200c20c7f712ada20a6111ca31538 /lib/query/create.ml | |
| parent | 9f2a57603dbfce428af36e82fb1c7cdc6e1ad0da (diff) | |
Renamed the module Typ into Types
Diffstat (limited to 'lib/query/create.ml')
| -rw-r--r-- | lib/query/create.ml | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/query/create.ml b/lib/query/create.ml index 49047a7..cf364cf 100644 --- a/lib/query/create.ml +++ b/lib/query/create.ml @@ -39,8 +39,7 @@ ADD FOREIGN KEY (best_a_id) REFERENCES answer(a_id); *) -let get_foreign_statement : - Model.Identifier.t -> Model.Identifier.t -> string = +let get_foreign_statement : Model.Identifier.t -> Model.Identifier.t -> string = fun property dst_table -> "FOREIGN KEY(" ^ Model.Identifier.quote property @@ -69,7 +68,7 @@ let create_external_reference_table : (* The target is the id of a row in the target content table, or in the dedicated table of the target list *) let target_table = - match reference.Model.Typ.t with + match reference.Model.Types.t with | Model.Reference.Content ref -> Model.Content.id (Model.Reference.get ref) | Model.Reference.List list -> list.Model.DataList.id @@ -129,7 +128,7 @@ let create_list_table : match Model.Field.type_ field with | T (MonoReference reference) -> ( let column = Model.Field.name field in - match reference.Model.Typ.t with + match reference.Model.Types.t with | Model.Reference.List target -> let dst = target.Model.DataList.id in if List.mem ~set:created dst then @@ -149,7 +148,7 @@ let create_list_table : let fields = "\"id\" INTEGER PRIMARY KEY" :: List.fold_left list_fields ~init:foreign ~f:(fun acc field -> - match get_field_query field with None -> acc | Some q -> q :: acc) + match get_field_query field with None -> acc | Some q -> q :: acc) in let buff = Buffer.create 128 in let format = Format.formatter_of_buffer buff in @@ -217,7 +216,7 @@ let rec create_table : match Model.Field.type_ field with | T (MonoReference reference) -> ( let column = Model.Field.name field in - match reference.Model.Typ.t with + match reference.Model.Types.t with | Model.Reference.List list -> (* The list tables are created before the content tables, so the constraint can be declared directly *) @@ -335,7 +334,8 @@ let create : Caqti_lwt.connection -> Configuration.Ast.setting -> unit Lwt.t = let* foreign, _ = Lwt_list.fold_left_s (fun acc list -> create_list_table db acc list) - ([], []) (Configuration.Ast.lists conf) + ([], []) + (Configuration.Ast.lists conf) in let contents = Configuration.Ast.root_contents conf in let* foreign, _ = |
