oradm-to-gql 34.0.0 → 34.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oradm-to-gql",
3
- "version": "34.0.0",
3
+ "version": "34.0.2",
4
4
  "description": "Oracle Data Modeler CSV Export to Apollo GraphQL Endpoint Generator",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,7 +28,7 @@
28
28
  "graphql-type-json": "^0.1.4",
29
29
  "lodash": "^4.17.4",
30
30
  "mustache": "^2.3.0",
31
- "nunjucks": "^3.0.1",
31
+ "nunjucks": "^3.2.3",
32
32
  "pluralize": "^5.0.0",
33
33
  "sql-formatter": "^1.2.2",
34
34
  "uuid": "^3.3.2"
@@ -55,6 +55,6 @@
55
55
  "pg": "^6.4.0",
56
56
  "require-from-string": "^1.2.1",
57
57
  "tg-client-query-builder": "^2.2.0",
58
- "tg-knex-query-resolver": "^4.0.0"
58
+ "tg-knex-query-resolver": "^4.1.0"
59
59
  }
60
60
  }
@@ -125,10 +125,19 @@ module.exports = function convertRowsToTableMap(
125
125
  refAssociation.name = pluralize.plural(refAssociation.name);
126
126
  }
127
127
 
128
+ // TODO: we could better obtain this info from the ODM XML file.
128
129
  if (_.endsWith(fkRelation.Relation_Name, "_cascade")) {
129
130
  tabAttr.referenceShouldCascade = true;
130
131
  }
131
132
 
133
+ if (_.endsWith(fkRelation.Relation_Name, "_restrict")) {
134
+ tabAttr.referenceShouldRestrict = true;
135
+ }
136
+
137
+ if (_.endsWith(fkRelation.Relation_Name, "_noaction")) {
138
+ tabAttr.referenceShouldNoAction = true;
139
+ }
140
+
132
141
  refModel.associations.push(refAssociation);
133
142
  tableMap[refDef.entityName] = refModel;
134
143
  }
@@ -134,6 +134,11 @@ module.exports = function (
134
134
  if (attrName == "code") relSpec.onUpdate = "CASCADE";
135
135
  if (!attrDef.nullable || attrDef.referenceShouldCascade === true)
136
136
  relSpec.onDelete = "CASCADE";
137
+ if (attrDef.referenceShouldNoAction === true)
138
+ relSpec.onDelete = "NO ACTION";
139
+ if (attrDef.referenceShouldRestrict === true)
140
+ relSpec.onDelete = "RESTRICT";
141
+
137
142
  knexSpec.relationships.push(relSpec);
138
143
  }
139
144