From 3df36ca6a0b45e5e34ba3e0ec5b366fcfdb8d866 Mon Sep 17 00:00:00 2001 From: jopejoe1 Date: Thu, 8 Feb 2024 21:13:25 +0100 Subject: [PATCH] add stucture creation --- data/create_strucure.surrealql | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 data/create_strucure.surrealql diff --git a/data/create_strucure.surrealql b/data/create_strucure.surrealql new file mode 100644 index 0000000..2881cfb --- /dev/null +++ b/data/create_strucure.surrealql @@ -0,0 +1,76 @@ +DEFINE NAMESPACE krautundrueben; +USE NS krautundrueben; +DEFINE DATABASE stable; +USE DB stable; + + +DEFINE TABLE Customer SCHEMALESS; + +DEFINE FIELD first_name ON TABLE Customer TYPE string; +DEFINE FIELD last_name ON TABLE Customer TYPE string; +DEFINE FIELD birth_date ON TABLE Customer TYPE string; +DEFINE FIELD phone ON TABLE Customer TYPE string; +DEFINE FIELD address ON TABLE Customer TYPE record
; +DEFINE FIELD email ON TABLE Customer TYPE string + ASSERT string::is::email($value); + + +DEFINE TABLE Supplier SCHEMALESS; + +DEFINE FIELD name ON TABLE Supplier TYPE string; +DEFINE FIELD phone ON TABLE Supplier TYPE string; +DEFINE FIELD address ON TABLE Supplier TYPE record
; +DEFINE FIELD email ON TABLE Supplier TYPE string + ASSERT string::is::email($value); + + +DEFINE TABLE Ingredient SCHEMALESS; + +DEFINE FIELD designation ON TABLE Ingredient TYPE string; +DEFINE FIELD unit ON TABLE Ingredient TYPE string; +DEFINE FIELD net_price ON TABLE Ingredient TYPE float; +DEFINE FIELD stock ON TABLE Ingredient TYPE int; +DEFINE FIELD calories ON TABLE Ingredient TYPE int; +DEFINE FIELD carbohydrates ON TABLE Ingredient TYPE float; +DEFINE FIELD protein ON TABLE Ingredient TYPE float; + + +DEFINE TABLE Order SCHEMALESS; + +DEFINE FIELD invoice_amount ON TABLE Order TYPE float; +DEFINE FIELD net_price ON TABLE Order TYPE float; +DEFINE FIELD order_date ON TABLE Order TYPE string; +DEFINE FIELD customer ON TABLE Order TYPE record; + +DEFINE TABLE Recipe SCHEMALESS; + +DEFINE FIELD preparation_time ON TABLE Recipe TYPE int; +DEFINE FIELD name ON TABLE Recipe TYPE string; +DEFINE FIELD description ON TABLE Recipe TYPE string; +DEFINE FIELD instructions ON TABLE Recipe TYPE string; + +DEFINE TABLE Address SCHEMALESS; + +DEFINE FIELD city ON TABLE Address TYPE string; +DEFINE FIELD street ON TABLE Address TYPE string; +DEFINE FIELD house_number ON TABLE Address TYPE string; +DEFINE FIELD postal_code ON TABLE Address TYPE string; + +DEFINE TABLE RecipeContainsIngredients SCHEMALESS; + +DEFINE FIELD amount ON TABLE RecipeContainsIngredients TYPE int; +DEFINE FIELD recipe ON TABLE RecipeContainsIngredients TYPE record; +DEFINE FIELD ingredient ON TABLE RecipeContainsIngredients TYPE record; + +DEFINE TABLE SupplierContainsIngredients SCHEMALESS; + +DEFINE FIELD delivery_cost ON TABLE SupplierContainsIngredients TYPE float; +DEFINE FIELD delivery_time ON TABLE SupplierContainsIngredients TYPE int; +DEFINE FIELD supplier ON TABLE SupplierContainsIngredients TYPE record; +DEFINE FIELD ingredient ON TABLE SupplierContainsIngredients TYPE record; + +DEFINE TABLE OrderContainsIngredients SCHEMALESS; + +DEFINE FIELD quantity ON TABLE OrderContainsIngredients TYPE int; +DEFINE FIELD `order` ON TABLE OrderContainsIngredients TYPE record; +DEFINE FIELD ingredient ON TABLE OrderContainsIngredients TYPE record; \ No newline at end of file