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