diff --git a/generate-schema-graph.js b/generate-schema-graph.js
index 0dac646..9ee5531 100644
--- a/generate-schema-graph.js
+++ b/generate-schema-graph.js
@@ -19,7 +19,7 @@ function parseSchema(source) {
const initName = initMatch[1];
const sqlBlock = initMatch[2];
- const createRegex = /CREATE TABLE\s+(\w+)\s*\(([\s\S]*?)\);/gi;
+ const createRegex = /CREATE TABLE\s+\[?(\w+)\]?\s*\(([\s\S]*?)\);/gi;
let createMatch;
while ((createMatch = createRegex.exec(sqlBlock)) !== null) {
@@ -89,7 +89,7 @@ function parseSchema(source) {
}
const alterAddColumnRegex =
- /ALTER TABLE\s+(\w+)\s+ADD\s+(\w+)\s+([\w]+(?:\([^)]*\))?)(?:\s+(NOT NULL|NULL))?\s*;/gi;
+ /ALTER TABLE\s+\[?(\w+)\]?\s+ADD\s+\[?(\w+)\]?\s+([\w]+(?:\([^)]*\))?)(?:\s+(NOT NULL|NULL))?\s*;/gi;
let alterColumnMatch;
while ((alterColumnMatch = alterAddColumnRegex.exec(sqlBlock)) !== null) {
@@ -105,7 +105,7 @@ function parseSchema(source) {
}
const alterFkRegex =
- /ALTER TABLE\s+(\w+)\s+ADD CONSTRAINT\s+(\w+)\s+FOREIGN KEY\s*\(([^)]+)\)\s+REFERENCES\s+\[?(\w+)\]?\(([^)]+)\)(?:\s+ON DELETE\s+([\w\s]+?))?\s*;/gi;
+ /ALTER TABLE\s+\[?(\w+)\]?\s+ADD CONSTRAINT\s+(\w+)\s+FOREIGN KEY\s*\(([^)]+)\)\s+REFERENCES\s+\[?(\w+)\]?\(([^)]+)\)(?:\s+ON DELETE\s+([\w\s]+?))?\s*;/gi;
let alterMatch;
while ((alterMatch = alterFkRegex.exec(sqlBlock)) !== null) {
diff --git a/schema-graph.dot b/schema-graph.dot
index 215f27c..5379078 100644
--- a/schema-graph.dot
+++ b/schema-graph.dot
@@ -16,7 +16,7 @@ digraph schema {
entityaddress [label=<
| entityaddress |
|
|
|
|
|
| streetnumber? | NVARCHAR(50) |
|
|
|
|
|
|
>];
companyuser [label=<>];
entitycontact [label=<>];
- company [label=< |
|
| poscustomergroup_id | INT FK |
|
| default_language_id? | INT FK |
|
|
|
|
|
|
>];
+ company [label=< |
|
| poscustomergroup_id | INT FK |
|
| default_language_id? | INT FK |
|
|
|
|
|
|
>];
syncpos [label=<>];
entityhistory [label=<>];
companysetting [label=<>];
@@ -35,17 +35,17 @@ digraph schema {
label="Catalog"; labeljust="l"; fontsize=15;
style="rounded,filled"; fillcolor="#202a3a"; color="#3f4c5f";
fontcolor="#e2e8f0"; margin=14;
- categoryarticle [label=<>];
- articlehistory [label=<>];
- category [label=<>];
- article [label=<>];
- articleean [label=<>];
- articlelist [label=<>];
- articlelistarticle [label=<>];
- articlesupplier [label=<>];
- brand [label=<>];
optionslist [label=<>];
- optionslistarticle [label=<>];
+ categoryarticle [label=<>];
+ optionslistarticle [label=<>];
+ category [label=<>];
+ articlehistory [label=<>];
+ article [label=<>];
+ articlelist [label=<>];
+ articleean [label=<>];
+ articlelistarticle [label=<>];
+ brand [label=<>];
+ articlesupplier [label=<>];
}
subgraph cluster_media {
label="Media"; labeljust="l"; fontsize=15;
@@ -55,6 +55,7 @@ digraph schema {
pic [label=< |
|
|
|
|
|
|
|
|
|
|
| thumbbinary | VARBINARY(MAX) |
|
>];
brandpic [label=<>];
articlepic [label=<>];
+ file [label=<>];
}
subgraph cluster_manifests {
label="Documents"; labeljust="l"; fontsize=15;
@@ -70,7 +71,7 @@ digraph schema {
style="rounded,filled"; fillcolor="#202a3a"; color="#3f4c5f";
fontcolor="#e2e8f0"; margin=14;
tax [label=<>];
- price [label=< |
|
|
|
|
| minmultiplier | DECIMAL(18,4) |
|
|
>];
+ price [label=< |
|
|
|
|
| minmultiplier | DECIMAL(18,4) |
|
|
>];
}
subgraph cluster_units {
label="Units"; labeljust="l"; fontsize=15;
@@ -90,13 +91,13 @@ digraph schema {
google_auth:selected_company:w -> company:in7:n [color="#ff6b6b", fontcolor="#ff6b6b", tooltip="FK_google_auth_selected_company", weight=3];
category:parent_id:e -> category:id:e [color="#6bdf9a", fontcolor="#6bdf9a", tooltip="FK_category_parent", constraint=false];
- company:root_category_id:e -> category:in0:n [color="#5aa7ff", fontcolor="#5aa7ff", tooltip="FK_company_root_category", weight=3];
+ company:root_category_id:w -> category:in1:n [color="#5aa7ff", fontcolor="#5aa7ff", tooltip="FK_company_root_category", weight=3];
company:default_language_id:se -> language:in0:n [color="#f5c15c", fontcolor="#f5c15c", tooltip="FK_company_default_language", constraint=false, weight=1];
- company:taxrate:e -> tax:in1:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_company_taxrate", constraint=false, weight=1];
+ company:taxrate:e -> tax:in3:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_company_taxrate", constraint=false, weight=1];
company:reducedtaxrate:e -> tax:in0:n [color="#ff9f5a", fontcolor="#ff9f5a", tooltip="FK_company_reducedtaxrate", constraint=false, weight=1];
company:taxfreerate:e -> tax:in2:n [color="#5cd6d6", fontcolor="#5cd6d6", tooltip="FK_company_taxfreerate", constraint=false, weight=1];
customergroup:company_id:w -> company:in2:n [color="#ff7fc2", fontcolor="#ff7fc2", tooltip="FK_customergroup_company", weight=3];
- company:poscustomergroup_id:w -> customergroup:in2:n [color="#8f95ff", fontcolor="#8f95ff", tooltip="FK_company_poscustomergroup", constraint=false, weight=1];
+ company:poscustomergroup_id:w -> customergroup:in1:n [color="#8f95ff", fontcolor="#8f95ff", tooltip="FK_company_poscustomergroup", constraint=false, weight=1];
entity:customergroup_id:nw -> customergroup:in0:n [color="#58d18a", fontcolor="#58d18a", tooltip="FK_entity_customergroup", weight=3];
entityaddress:entity_id:se -> entity:in1:n [color="#ff8f66", fontcolor="#ff8f66", tooltip="FK_entityaddress_entity", weight=3];
entitycontact:entity_id:nw -> entity:in2:n [color="#4fc4e8", fontcolor="#4fc4e8", tooltip="FK_entitycontact_entity", weight=3];
@@ -108,32 +109,32 @@ digraph schema {
brand:company_id:e -> company:in9:n [color="#e0b25a", fontcolor="#e0b25a", tooltip="FK_brand_company", weight=3];
article:unit_id:w -> unit:in1:n [color="#56c8c8", fontcolor="#56c8c8", tooltip="FK_article_unit", constraint=false, weight=1];
article:brand_id:ne -> brand:in0:n [color="#ff5f9e", fontcolor="#ff5f9e", tooltip="FK_article_brand", constraint=false, weight=1];
- article:articlelist_id:nw -> articlelist:in1:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_article_articlelist", weight=3];
- article:optionslist_id:e -> optionslist:in0:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_article_optionslist", constraint=false, weight=1];
+ article:articlelist_id:sw -> articlelist:in0:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_article_articlelist", weight=3];
+ article:optionslist_id:w -> optionslist:in1:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_article_optionslist", constraint=false, weight=1];
article:fatherarticle_id:e -> article:id:e [color="#66b3ff", fontcolor="#66b3ff", tooltip="FK_article_fatherarticle", constraint=false];
articlehistory:article_id:ne -> article:in3:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_articlehistory_article", weight=3];
articlehistory:companyuser_id:w -> companyuser:in1:n [color="#ff6b6b", fontcolor="#ff6b6b", tooltip="FK_articlehistory_companyuser", constraint=false, weight=1];
- articleean:article_id:sw -> article:in5:n [color="#6bdf9a", fontcolor="#6bdf9a", tooltip="FK_articleean_article", weight=3];
+ articleean:article_id:sw -> article:in6:n [color="#6bdf9a", fontcolor="#6bdf9a", tooltip="FK_articleean_article", weight=3];
articlepic:article_id:e -> article:in9:n [color="#5aa7ff", fontcolor="#5aa7ff", tooltip="FK_articlepic_article", weight=3];
articlepic:pic_id:w -> pic:in2:n [color="#f5c15c", fontcolor="#f5c15c", tooltip="FK_articlepic_pic", constraint=false, weight=1];
- brandpic:brand_id:e -> brand:in1:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_brandpic_brand", weight=3];
- brandpic:pic_id:nw -> pic:in1:n [color="#ff9f5a", fontcolor="#ff9f5a", tooltip="FK_brandpic_pic", constraint=false, weight=1];
- articlelistarticle:articlelist_id:sw -> articlelist:in0:n [color="#5cd6d6", fontcolor="#5cd6d6", tooltip="FK_articlelistarticle_articlelist", weight=3];
- articlelistarticle:article_id:w -> article:in6:n [color="#ff7fc2", fontcolor="#ff7fc2", tooltip="FK_articlelistarticle_article", constraint=false, weight=1];
- optionslistarticle:optionslist_id:se -> optionslist:in1:n [color="#8f95ff", fontcolor="#8f95ff", tooltip="FK_optionslistarticle_optionslist", weight=3];
- optionslistarticle:article_id:w -> article:in8:n [color="#58d18a", fontcolor="#58d18a", tooltip="FK_optionslistarticle_article", constraint=false, weight=1];
- categoryarticle:category_id:se -> category:in2:n [color="#ff8f66", fontcolor="#ff8f66", tooltip="FK_categoryarticle_category", weight=3];
+ brandpic:brand_id:w -> brand:in1:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_brandpic_brand", weight=3];
+ brandpic:pic_id:ne -> pic:in1:n [color="#ff9f5a", fontcolor="#ff9f5a", tooltip="FK_brandpic_pic", constraint=false, weight=1];
+ articlelistarticle:articlelist_id:sw -> articlelist:in1:n [color="#5cd6d6", fontcolor="#5cd6d6", tooltip="FK_articlelistarticle_articlelist", weight=3];
+ articlelistarticle:article_id:w -> article:in8:n [color="#ff7fc2", fontcolor="#ff7fc2", tooltip="FK_articlelistarticle_article", constraint=false, weight=1];
+ optionslistarticle:optionslist_id:sw -> optionslist:in0:n [color="#8f95ff", fontcolor="#8f95ff", tooltip="FK_optionslistarticle_optionslist", weight=3];
+ optionslistarticle:article_id:se -> article:in2:n [color="#58d18a", fontcolor="#58d18a", tooltip="FK_optionslistarticle_article", constraint=false, weight=1];
+ categoryarticle:category_id:se -> category:in3:n [color="#ff8f66", fontcolor="#ff8f66", tooltip="FK_categoryarticle_category", weight=3];
categoryarticle:article_id:ne -> article:in0:n [color="#4fc4e8", fontcolor="#4fc4e8", tooltip="FK_categoryarticle_article", constraint=false, weight=1];
categorypic:category_id:e -> category:in5:n [color="#a98cff", fontcolor="#a98cff", tooltip="FK_categorypic_category", weight=3];
categorypic:pic_id:nw -> pic:in0:n [color="#ff6f6f", fontcolor="#ff6f6f", tooltip="FK_categorypic_pic", constraint=false, weight=1];
- categorytext:category_id:e -> category:in1:n [color="#4ecb8f", fontcolor="#4ecb8f", tooltip="FK_categorytext_category", weight=3];
+ categorytext:category_id:se -> category:in2:n [color="#4ecb8f", fontcolor="#4ecb8f", tooltip="FK_categorytext_category", weight=3];
categorytext:language_id:nw -> language:in3:n [color="#5aa7e6", fontcolor="#5aa7e6", tooltip="FK_categorytext_language", constraint=false, weight=1];
articletext:article_id:w -> article:in1:n [color="#ff7aa8", fontcolor="#ff7aa8", tooltip="FK_articletext_article", weight=3];
articletext:language_id:w -> language:in2:n [color="#e0b25a", fontcolor="#e0b25a", tooltip="FK_articletext_language", constraint=false, weight=1];
- price:tax_id:w -> tax:in3:n [color="#56c8c8", fontcolor="#56c8c8", tooltip="FK_price_tax", constraint=false, weight=1];
- price:article_id:sw -> article:in2:n [color="#ff5f9e", fontcolor="#ff5f9e", tooltip="FK_price_article", weight=3];
- price:customergroup_id:e -> customergroup:in1:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_price_customergroup", constraint=false, weight=1];
- articlesupplier:article_id:sw -> article:in7:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_articlesupplier_article", weight=3];
+ price:tax_id:w -> tax:in1:n [color="#56c8c8", fontcolor="#56c8c8", tooltip="FK_price_tax", constraint=false, weight=1];
+ price:article_id:e -> article:in7:n [color="#ff5f9e", fontcolor="#ff5f9e", tooltip="FK_price_article", weight=3];
+ price:customergroup_id:e -> customergroup:in2:n [color="#ffb25a", fontcolor="#ffb25a", tooltip="FK_price_customergroup", constraint=false, weight=1];
+ articlesupplier:article_id:sw -> article:in5:n [color="#56d68a", fontcolor="#56d68a", tooltip="FK_articlesupplier_article", weight=3];
articlesupplier:entity_id:w -> entity:in4:n [color="#66b3ff", fontcolor="#66b3ff", tooltip="FK_articlesupplier_entity", constraint=false, weight=1];
articlesupplier:price_id:e -> price:in0:n [color="#c79bff", fontcolor="#c79bff", tooltip="FK_articlesupplier_price", constraint=false, weight=1];
manifest:company_id:e -> company:in1:n [color="#ff6b6b", fontcolor="#ff6b6b", tooltip="FK_manifest_company", weight=3];
@@ -147,7 +148,7 @@ digraph schema {
companysetting:company_id:sw -> company:in6:n [color="#8f95ff", fontcolor="#8f95ff", tooltip="FK_companysetting_company", weight=3];
posterminal:company_id:e -> company:in0:n [color="#58d18a", fontcolor="#58d18a", tooltip="FK_posterminal_company", weight=3];
posterminalcategory:posterminal_id:sw -> posterminal:in0:n [color="#ff8f66", fontcolor="#ff8f66", tooltip="FK_posterminalcategory_posterminal", weight=3];
- posterminalcategory:category_id:e -> category:in3:n [color="#4fc4e8", fontcolor="#4fc4e8", tooltip="FK_posterminalcategory_category", constraint=false, weight=1];
- manifestattachment:manifest_id:se -> manifest:in1:n [color="#a98cff", fontcolor="#a98cff", tooltip="FK_manifestattachment_manifest", weight=3];
- manifestattachment:file_id:w -> file:in0:n [color="#ff6f6f", fontcolor="#ff6f6f", tooltip="FK_manifestattachment_file", constraint=false, weight=1];
+ posterminalcategory:category_id:e -> category:in0:n [color="#4fc4e8", fontcolor="#4fc4e8", tooltip="FK_posterminalcategory_category", constraint=false, weight=1];
+ manifestattachment:manifest_id:sw -> manifest:in1:n [color="#a98cff", fontcolor="#a98cff", tooltip="FK_manifestattachment_manifest", weight=3];
+ manifestattachment:file_id:e -> file:in0:n [color="#ff6f6f", fontcolor="#ff6f6f", tooltip="FK_manifestattachment_file", constraint=false, weight=1];
}
\ No newline at end of file
diff --git a/schema-graph.svg b/schema-graph.svg
index ad75f08..5d99c2e 100644
--- a/schema-graph.svg
+++ b/schema-graph.svg
@@ -4,11 +4,11 @@
-