diff --git a/README.md b/README.md index c5c3f641..3444dcfe 100644 --- a/README.md +++ b/README.md @@ -97,10 +97,12 @@ EXAMPLES OF VALID JSON FILES "associations" : { "person" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", + "reverseAssociation": "dogs", "target" : "Person", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql" } } @@ -119,10 +121,12 @@ EXAMPLES OF VALID JSON FILES }, "associations":{ "books" : { - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", + "reverseAssociation": "publisher", "target" : "Book", "targetKey" : "publisherId", - "keyIn" : "Book", + "keysIn" : "Book", "targetStorageType" : "sql" } } @@ -153,32 +157,38 @@ Example: ### Associations Spec -We will consider two types of associations accordingly to the number of records -that can posibly be associated: -1. to_one -2. to_many +We will consider four types of associations according to the relation between associated records of the two models: +1. one_to_one +2. many_to_one +3. one_to_many +4. many_to_many -For both type of association, the necessary arguments would be: +For all types of association, the necessary arguments would be: name | Type | Description ------- | ------- | -------------- -*type* | String | Type of association (like belongsTo, etc.) +*type* | String | Type of association (`one_to_one`, `one_to_many`, etc.) +*implementation* | String | implementation type of the association. Can be one of `foreignkeys`, `generic` or `sql_cross_table` (only for `many_to_many`)` +*reverseAssociation* | String | The name of the reverse association from the other model. This field is only mandatory for building the [single-page-app](https://github.com/Zendro-dev/single-page-app), *not* for generating the the graphql-server code via this repository. *target* | String | Name of model to which the current model will be associated with. *targetKey* | String | A unique identifier of the association for the case where there appear more than one association with the same model. -*keyIn* | String | Name of the model where the targetKey is stored. +*keysIn* | String | Name of the model where the targetKey is stored. *targetStorageType* | String | Type of storage where the target model is stored. So far can be one of __sql__ or __Webservice__. *label* | String | Name of the column in the target model to be used as a display name in the GUI. *sublabel* | String | Optional name of the column in the target model to be used as a sub-label in the GUI. -When the association is of type *to_many* and it referes to a more particular type of association *many_to_many* it's necessary to describe two extra arguments given that the association is made with a cross table. These arguments are: +**Note**: The `keysIn` argument points to the model that stores the information about the foreignKey(s). That can be either a single key, a foreignkey array or a cross-model. + +When the association is of type *many_to_many* it's necessary to describe an extra argument *sourceKey*: name | Type | Description ------- | ------- | -------------- *sourceKey* | String | Key to identify the source id -*keysIn* | String | Name of the cross table + +Be aware that in case of a *many_to_many* via an *sql_cross_table* implementation the keysIn field points to the cross model. ## NOTE: -Be aware that in the case of this type of association the user is required to describe the cross table used in the field _keysIn_ as a model in its own. For example, if we have a model `User` and a model `Role` and they are associated in a _manytomany_ way, then we also need to describe the `role_to_user` model: +Be aware that in the case of this type of association the user is required to describe the cross table used in the field _keysIn_ as a model in its own. For example, if we have a model `User` and a model `Role` and they are associated in a `many_to_many` way, then we also need to describe the `role_to_user` model: ```jsonc //User model @@ -191,7 +201,9 @@ Be aware that in the case of this type of association the user is required to de }, "associations" :{ "roles" : { - "type" : "to_many", + "type" : "many_to_many", + "implementation": "foreignkeys", + "reverseAssociation": "dogs", "target" : "Role", "targetKey" : "role_Id", "sourceKey" : "user_Id", @@ -215,8 +227,10 @@ Be aware that in the case of this type of association the user is required to de }, "associations" : { "users" : { - "type" : "to_many", + "type" : "many_to_many", "target" : "User", + "implementation": "sql_cross_table", + "reverseAssociation": "roles", "targetKey" : "user_Id", "sourceKey" : "role_Id", "keysIn" : "role_to_user", @@ -254,11 +268,13 @@ Example: }, "associations":{ "publisher" : { - "type" : "to_one", // association type + "type" : "many_to_one", // association type + "implementation": "foreignkeys", // standard implementation via foreign keys + "reverseAssociation": "dogs", // name of the association in the publisher model "target" : "publisher", // Model's name is `publisher` "targetKey" : "publisher_id", // Local alias for this association - "keyIn": "book", // FK to publisher will be stored in the Book model - "targetStorageType" : Webservice", // It's a remote database + "keysIn": "book", // FK to publisher will be stored in the Book model + "targetStorageType" : "Webservice", // It's a remote database "label" : "name" // Show in GUI the name of the publisher taken from external DB } } @@ -276,13 +292,15 @@ Example: "model" : "Book", "storageType" : "SQL", "attributes" : { - "id" : Int, + "id" : "Int", "title" : {"type":"String", "description": "The book's title"}, - "ISBN": Int + "ISBN": "Int" }, "associations" : { "authors" : { - "type" : "to_many", + "type" : "many_to_many", + "implementation": "sql_cross_table", + "reverseAssociation": "books", "target" : "Person", "targetKey" : "person_id", "sourceKey" : "book_id", diff --git a/funks.js b/funks.js index cef9c62b..67e10dbf 100644 --- a/funks.js +++ b/funks.js @@ -656,15 +656,34 @@ validateJsonFile = function (opts) { } }); - //check: validate if to_one assoc with foreignKey in target model exists - // Warn user that validation e.g. unique constraint needs to be added - opts.associationsArguments["to_one"].forEach((assoc) => { - if (assoc.holdsForeignKey === false) { + const { + to_one, + to_many, + to_many_through_sql_cross_table, + generic_to_one, + generic_to_many } = opts.associationsArguments; + + const parsedAssociations = to_one.concat(to_many,to_many_through_sql_cross_table, generic_to_many, generic_to_one); + + parsedAssociations.forEach((assoc) => { + + //check: validate if to_one assoc with foreignKey in target model exists + // Warn user that validation e.g. unique constraint needs to be added + if (assoc.holdsForeignKey === false && assoc.type.includes('to_one')) { check.warnings.push( - `WARNING: ${assoc.name} is a to_one associations with the foreignKey in ${assoc.target}. Be sure to validate uniqueness` + `WARNING: Association ${assoc.name} is a ${assoc.type} associations with the foreignKey in ${assoc.target}. Be sure to validate uniqueness` ); } - }); + + //check: validate if the reverseAssociation field exist. Warn the user that + // it is mandatory for the spa + if (!assoc.reverseAssociation) { + check.warnings.push( + ` WARNING: Association ${assoc.name} does not define the reverse association name in field "reverseAssociation". This field is mandatory for the single-page-app.` + ) + } + }) + return check; }; @@ -672,14 +691,14 @@ validateJsonFile = function (opts) { getEditableAssociations = function (associations) { let editableAssociations = []; associations["to_one"].forEach((association) => { - if (association.keyIn !== association.target) { + if (association.keysIn !== association.target) { editableAssociations.push(association); } }); //for cases many to many through foreignKey array associations["to_many"].forEach((association) => { - if (association.keyIn !== association.target) { + if (association.keysIn !== association.target) { editableAssociations.push(association); } }); @@ -694,7 +713,7 @@ getEditableAttributes = function ( ) { let editable_attributes = {}; let target_keys = parsedAssocForeignKeys.map((assoc) => { - if (assoc.reverseAssociationType) return assoc.sourceKey; + if (assoc.type === 'many_to_many' && assoc.implementation === 'foreignkeys') return assoc.sourceKey; return assoc.targetKey; }); for (let attrib in attributes) { @@ -733,124 +752,125 @@ module.exports.parseAssociations = function (dataModel) { }; if (associations !== undefined) { Object.entries(associations).forEach(([name, association]) => { - let type = association.type; - let holdsTheForeignKey = false; - let assocThroughArray = false; - let isStandardAssociation = - association.type !== "generic_to_many" && - association.type !== "generic_to_one"; - - //push association - if (isStandardAssociation) { - //standard - associations_info.associations.push(association); - association.targetStorageType = - association.targetStorageType.toLowerCase(); - associations_info.foreignKeyAssociations[name] = association.targetKey; - } else { - //generic - associations_info.genericAssociations.push(association); - } + + const type = association.type; + const implementation = association.implementation; + + const schema_attributes = [ + association.target, + capitalizeString(association.target), + capitalizeString(name), + ]; + let assoc = Object.assign({}, association); - //if(associations_type["many"].includes(association.type) ) - if (association.type === "to_many") { - //associations_info.schema_attributes["many"][name] = [ association.target, capitalizeString(association.target), capitalizeString(inflection.pluralize(association.target))]; - associations_info.schema_attributes["many"][name] = [ - association.target, - capitalizeString(association.target), - capitalizeString(name), - ]; - if (association.reverseAssociationType === "to_many") { - assocThroughArray = true; - } - //}else if(associations_type["one"].includes(association.type)) - } else if (association.type === "to_one") { - associations_info.schema_attributes["one"][name] = [ - association.target, - capitalizeString(association.target), - capitalizeString(name), - ]; - if (association.keyIn === dataModel.model) { - holdsTheForeignKey = true; - } - } else if (association.type === "to_many_through_sql_cross_table") { - if ( - association.sourceKey === undefined || - association.keysIn === undefined || - association.targetStorageType !== "sql" - ) { - console.error( - colors.red( - `ERROR: to_many_through_sql_cross_table only allowed for relational database types with well defined cross-table` - ) - ); - } - associations_info.schema_attributes["many"][name] = [ - association.target, - capitalizeString(association.target), - capitalizeString(name), - ]; - } else if (association.type === "generic_to_one") { - associations_info.schema_attributes["generic_one"][name] = [ - association.target, - capitalizeString(association.target), - capitalizeString(name), - ]; - } else if (association.type === "generic_to_many") { - associations_info.schema_attributes["generic_many"][name] = [ - association.target, - capitalizeString(association.target), - capitalizeString(name), - ]; - } else { + if (type !== 'one_to_one' && type !== 'one_to_many' && type !== 'many_to_one' && type !== 'many_to_many') { console.error( colors.red("Association type " + association.type + " not supported.") ); } - let assoc = Object.assign({}, association); - //push association - if (isStandardAssociation) { - //standard - assoc["name"] = name; - assoc["name_lc"] = uncapitalizeString(name); - assoc["name_cp"] = capitalizeString(name); - assoc["target_lc"] = uncapitalizeString(association.target); - assoc["target_lc_pl"] = inflection.pluralize( - uncapitalizeString(association.target) - ); - assoc["target_pl"] = inflection.pluralize(association.target); - assoc["target_cp"] = capitalizeString(association.target); //inflection.capitalize(association.target); - assoc["target_cp_pl"] = capitalizeString( - inflection.pluralize(association.target) - ); //inflection.capitalize(inflection.pluralize(association.target)); + // set default association fields + assoc["name"] = name; + assoc["name_lc"] = uncapitalizeString(name); + assoc["name_cp"] = capitalizeString(name); + assoc["target_lc"] = uncapitalizeString(association.target); + assoc["target_lc_pl"] = inflection.pluralize( + uncapitalizeString(association.target) + ); + assoc["target_pl"] = inflection.pluralize(association.target); + assoc["target_cp"] = capitalizeString(association.target); //inflection.capitalize(association.target); + assoc["target_cp_pl"] = capitalizeString( + inflection.pluralize(association.target) + ); + assoc["reverseAssociation"] = association.reverseAssociation; + + if (implementation !== 'generic') { + // set extra association fields assoc["targetKey"] = association.targetKey; assoc["targetKey_cp"] = capitalizeString(association.targetKey); - if (association.keyIn) { - assoc["keyIn_lc"] = uncapitalizeString(association.keyIn); - } - assoc["holdsForeignKey"] = holdsTheForeignKey; - assoc["assocThroughArray"] = assocThroughArray; + assoc["keysIn_lc"] = uncapitalizeString(association.keysIn); + assoc["holdsForeignKey"] = false; + assoc["assocThroughArray"] = false; + + assoc.targetStorageType = association.targetStorageType.toLowerCase(); + association.targetStorageType = association.targetStorageType.toLowerCase(); + associations_info.associations.push(association); + associations_info.foreignKeyAssociations[name] = association.targetKey; } else { - //generic - assoc["name"] = name; - assoc["name_lc"] = uncapitalizeString(name); - assoc["name_cp"] = capitalizeString(name); - assoc["target_lc"] = uncapitalizeString(association.target); - assoc["target_lc_pl"] = inflection.pluralize( - uncapitalizeString(association.target) - ); - assoc["target_pl"] = inflection.pluralize(association.target); - assoc["target_cp"] = capitalizeString(association.target); //inflection.capitalize(association.target); - assoc["target_cp_pl"] = capitalizeString( - inflection.pluralize(association.target) - ); //inflection.capitalize(inflection.pluralize(association.target)); + associations_info.genericAssociations.push(association); + } + // switch implementation types + switch (implementation) { + case 'generic': + switch (type) { + case 'one_to_one': + case 'many_to_one': + associations_info.schema_attributes["generic_one"][name] = schema_attributes; + associations_info['generic_to_one'].push(assoc); + break; + case 'one_to_many': + case 'many_to_many': + associations_info.schema_attributes["generic_many"][name] = schema_attributes; + associations_info['generic_to_many'].push(assoc); + break; + default: + break; + } + break; + case 'sql_cross_table': + if (type !== 'many_to_many' + || association.sourceKey === undefined + || association.keysIn === undefined ) { + console.error( + colors.red( + `ERROR: many_to_many through crosstable only allowed for relational database types with well defined cross-table` + ) + ); + } + + associations_info.schema_attributes["many"][name] = schema_attributes; + associations_info['to_many_through_sql_cross_table'].push(assoc); + break; + case 'foreignkeys': + associations_info.foreignKeyAssociations[name] = association.targetKey; + switch (type) { + case 'one_to_one': + case 'many_to_one': + // schema attrtibutes + associations_info.schema_attributes["one"][name] = schema_attributes; + // holds foreignKey ? + if (association.keysIn === dataModel.model) { + assoc["holdsForeignKey"] = true; + } + associations_info['to_one'].push(assoc); + break; + case 'many_to_many': + assoc["assocThroughArray"] = true; + case 'one_to_many': + associations_info.schema_attributes["many"][name] = schema_attributes; + associations_info['to_many'].push(assoc); + break; + default: + break; + } + break; + default: + if (implementation) { + console.error( + colors.red( + `ERROR: unallowed association implementation type ${implementation}.` + ) + ); + } else { + console.error( + colors.red( + `ERROR: Please specify an implementation type.` + ) + ); + } } - - associations_info[type].push(assoc); - //associations_info[type].push(assoc); }); - } + }; associations_info.mutations_attributes = attributesToString( associations_info.mutations_attributes ); diff --git a/test/integration_test_misc/integration_test_models_instance1/accession.json b/test/integration_test_misc/integration_test_models_instance1/accession.json index 6751f6d3..58d960a4 100644 --- a/test/integration_test_misc/integration_test_models_instance1/accession.json +++ b/test/integration_test_misc/integration_test_models_instance1/accession.json @@ -12,24 +12,26 @@ "associations": { "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn": "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn": "Measurement", "targetStorageType": "sql", "label": "name" } }, - "internalId" : "accession_id" + "internalId": "accession_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/amino_acid_sequence.json b/test/integration_test_misc/integration_test_models_instance1/amino_acid_sequence.json index 11b2492e..3e3dcae5 100644 --- a/test/integration_test_misc/integration_test_models_instance1/amino_acid_sequence.json +++ b/test/integration_test_misc/integration_test_models_instance1/amino_acid_sequence.json @@ -1,17 +1,18 @@ { - "model" : "aminoacidsequence", - "storageType" : "generic", - "attributes" : { - "accession" : "String", - "sequence" : "String" + "model": "aminoacidsequence", + "storageType": "generic", + "attributes": { + "accession": "String", + "sequence": "String" }, "associations": { "transcript_counts": { - "type" : "to_many", - "target" : "transcript_count", - "targetKey" : "aminoacidsequence_id", - "keyIn": "transcript_count", - "targetStorageType" : "sql" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "transcript_count", + "targetKey": "aminoacidsequence_id", + "keysIn": "transcript_count", + "targetStorageType": "sql" } } } diff --git a/test/integration_test_misc/integration_test_models_instance1/animal.json b/test/integration_test_misc/integration_test_models_instance1/animal.json index c9e5c473..8faadb4e 100644 --- a/test/integration_test_misc/integration_test_models_instance1/animal.json +++ b/test/integration_test_misc/integration_test_models_instance1/animal.json @@ -15,28 +15,30 @@ }, "associations": { "farm": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "farm", "targetKey": "farm_id", - "keyIn": "animal", + "keysIn": "animal", "targetStorageType": "mongodb", "label": "farm_name" }, - "food":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "food": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "food", "targetKey": "animal_ids", "sourceKey": "food_ids", - "keyIn": "animal", + "keysIn": "animal", "targetStorageType": "mongodb" }, - "unique_tracker":{ - "type" : "to_one", - "target" : "tracker", - "targetKey" : "animal_id", - "keyIn": "tracker", - "targetStorageType" : "mongodb" + "unique_tracker": { + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "tracker", + "targetKey": "animal_id", + "keysIn": "tracker", + "targetStorageType": "mongodb" } }, "internalId": "animal_id", diff --git a/test/integration_test_misc/integration_test_models_instance1/arr.json b/test/integration_test_misc/integration_test_models_instance1/arr.json index 89ddaeb0..7e961c5b 100644 --- a/test/integration_test_misc/integration_test_models_instance1/arr.json +++ b/test/integration_test_misc/integration_test_models_instance1/arr.json @@ -1,7 +1,7 @@ { "model": "Arr", "storageType": "sql", - "attributes" : { + "attributes": { "arrId": "String", "country": "String", "singleTime": "Time", @@ -14,7 +14,7 @@ "arrDateTime": "[DateTime]" }, - "internalId" : "arrId" + "internalId": "arrId" } \ No newline at end of file diff --git a/test/integration_test_misc/integration_test_models_instance1/author.json b/test/integration_test_misc/integration_test_models_instance1/author.json index 4b68be20..742ea191 100644 --- a/test/integration_test_misc/integration_test_models_instance1/author.json +++ b/test/integration_test_misc/integration_test_models_instance1/author.json @@ -1,8 +1,8 @@ { - "model" : "author", - "storageType" : "sql", + "model": "author", + "storageType": "sql", "database": "default-sql", - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", @@ -10,14 +10,14 @@ "book_ids": "[String]" }, - "associations":{ - "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "associations": { + "books": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "author", + "keysIn": "author", "targetStorageType": "sql" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/book.json b/test/integration_test_misc/integration_test_models_instance1/book.json index 7179b633..f0c6b2c6 100644 --- a/test/integration_test_misc/integration_test_models_instance1/book.json +++ b/test/integration_test_misc/integration_test_models_instance1/book.json @@ -1,8 +1,8 @@ { - "model" : "book", - "storageType" : "sql", + "model": "book", + "storageType": "sql", "database": "default-sql", - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -10,14 +10,14 @@ "author_ids": "[String]" }, - "associations":{ - "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "associations": { + "authors": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "book", + "keysIn": "book", "targetStorageType": "sql" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/capital.json b/test/integration_test_misc/integration_test_models_instance1/capital.json index b696a9aa..40bea893 100644 --- a/test/integration_test_misc/integration_test_models_instance1/capital.json +++ b/test/integration_test_misc/integration_test_models_instance1/capital.json @@ -1,24 +1,26 @@ { - "model" : "capital", - "storageType" : "SQL", - "attributes" : { - "name" : "String", + "model": "capital", + "storageType": "SQL", + "attributes": { + "name": "String", "country_id": "String", - "capital_id" : "String" + "capital_id": "String" }, "associations": { "unique_country": { - "type" : "to_one", - "target" : "country", - "targetKey" : "country_id", - "keyIn": "capital", - "targetStorageType" : "sql" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "country", + "targetKey": "country_id", + "keysIn": "capital", + "targetStorageType": "sql" }, "incidents": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Incident", "targetKey": "capital_id", - "keyIn": "Incident", + "keysIn": "Incident", "targetStorageType": "cassandra" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/cassandra-city.json b/test/integration_test_misc/integration_test_models_instance1/cassandra-city.json index 09ed7f42..3fb78bab 100644 --- a/test/integration_test_misc/integration_test_models_instance1/cassandra-city.json +++ b/test/integration_test_misc/integration_test_models_instance1/cassandra-city.json @@ -1,7 +1,7 @@ { - "model" : "city", - "storageType" : "cassandra", - "attributes" : { + "model": "city", + "storageType": "cassandra", + "attributes": { "city_id": "String", "name": "String", @@ -15,13 +15,13 @@ }, "associations": { "rivers": { - "type": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "river", "targetStorageType": "sql", "sourceKey": "river_ids", "targetKey": "city_ids", - "keyIn": "city", - "reverseAssociationType":"to_many" + "keysIn": "city" } }, "internalId": "city_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/cassandra-incident.json b/test/integration_test_misc/integration_test_models_instance1/cassandra-incident.json index d4ac9df2..da50eb16 100644 --- a/test/integration_test_misc/integration_test_models_instance1/cassandra-incident.json +++ b/test/integration_test_misc/integration_test_models_instance1/cassandra-incident.json @@ -11,21 +11,23 @@ "associations": { "instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Instant", "targetKey": "incident_assoc_id", - "keyIn" : "Instant", + "keysIn": "Instant", "targetStorageType": "cassandra" }, "town": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "capital", "targetKey": "capital_id", - "keyIn" : "Incident", + "keysIn": "Incident", "targetStorageType": "sql" } }, - "internalId" : "incident_id" + "internalId": "incident_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/cassandra-instant.json b/test/integration_test_misc/integration_test_models_instance1/cassandra-instant.json index 2a6b01df..0a320877 100644 --- a/test/integration_test_misc/integration_test_models_instance1/cassandra-instant.json +++ b/test/integration_test_misc/integration_test_models_instance1/cassandra-instant.json @@ -14,14 +14,15 @@ "associations": { "incident": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Incident", "targetKey": "incident_assoc_id", - "keyIn" : "Instant", + "keysIn": "Instant", "targetStorageType": "cassandra" } }, - "internalId" : "instant_id" + "internalId": "instant_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/country.json b/test/integration_test_misc/integration_test_models_instance1/country.json index 15106627..b130c544 100644 --- a/test/integration_test_misc/integration_test_models_instance1/country.json +++ b/test/integration_test_misc/integration_test_models_instance1/country.json @@ -1,25 +1,27 @@ { - "model" : "country", - "storageType" : "SQL", - "attributes" : { - "name" : "String", - "country_id" : "String" + "model": "country", + "storageType": "SQL", + "attributes": { + "name": "String", + "country_id": "String" }, "associations": { "unique_capital": { - "type" : "to_one", - "target" : "capital", - "targetKey" : "country_id", - "keyIn": "capital", - "targetStorageType" : "sql" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "capital", + "targetKey": "country_id", + "keysIn": "capital", + "targetStorageType": "sql" }, "rivers": { - "type" : "to_many_through_sql_cross_table", + "type": "many_to_many", + "implementation": "sql_cross_table", "target": "river", "sourceKey": "country_id", "targetKey": "river_id", "keysIn": "country_to_river", - "targetStorageType" : "sql" + "targetStorageType": "sql" } }, "internalId": "country_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/country_to_river.json b/test/integration_test_misc/integration_test_models_instance1/country_to_river.json index c40a3214..688ef690 100644 --- a/test/integration_test_misc/integration_test_models_instance1/country_to_river.json +++ b/test/integration_test_misc/integration_test_models_instance1/country_to_river.json @@ -1,8 +1,8 @@ { - "model" : "country_to_river", - "storageType" : "SQL", - "attributes" : { - "country_id" : "String", - "river_id" : "String" + "model": "country_to_river", + "storageType": "SQL", + "attributes": { + "country_id": "String", + "river_id": "String" } } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_animal.json b/test/integration_test_misc/integration_test_models_instance1/dist_animal.json index bcecb3a3..0bb74557 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_animal.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_animal.json @@ -1,6 +1,6 @@ { "model": "dist_animal", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_animal_instance1"], "attributes": { "animal_id": "String", @@ -16,13 +16,14 @@ "associations": { "dist_farm": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "dist_farm", "targetKey": "farm_id", - "keyIn" : "dist_animal", + "keysIn": "dist_animal", "targetStorageType": "distributed-data-model" } }, - "internalId" : "animal_id" + "internalId": "animal_id" } \ No newline at end of file diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_animal_instance1.json b/test/integration_test_misc/integration_test_models_instance1/dist_animal_instance1.json index b5eac6a5..e91566b1 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_animal_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_animal_instance1.json @@ -18,10 +18,11 @@ "associations": { "dist_farm": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "dist_farm", "targetKey": "farm_id", - "keyIn": "dist_animal", + "keysIn": "dist_animal", "targetStorageType": "distributed-data-model" } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_farm.json b/test/integration_test_misc/integration_test_models_instance1/dist_farm.json index 4f4f692d..3bd964b6 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_farm.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_farm.json @@ -1,6 +1,6 @@ { "model": "dist_farm", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_farm_instance1"], "attributes": { "farm_id": "String", @@ -9,10 +9,11 @@ }, "associations": { "dist_animals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "dist_animal", "targetKey": "farm_id", - "keyIn": "dist_animal", + "keysIn": "dist_animal", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_farm_instance1.json b/test/integration_test_misc/integration_test_models_instance1/dist_farm_instance1.json index 8df5fa83..2c8e9b0f 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_farm_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_farm_instance1.json @@ -10,10 +10,11 @@ }, "associations": { "dist_animals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "dist_animal", "targetKey": "farm_id", - "keyIn": "dist_animal", + "keysIn": "dist_animal", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_incident.json b/test/integration_test_misc/integration_test_models_instance1/dist_incident.json index 6fbc44c1..3b00b37c 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_incident.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_incident.json @@ -1,6 +1,6 @@ { "model": "Dist_incident", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_incident_instance1"], "cassandraRestrictions": true, "attributes": { @@ -12,14 +12,15 @@ "associations": { "dist_instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dist_instant", "targetKey": "incident_assoc_id", - "keyIn" : "Dist_instant", + "keysIn": "Dist_instant", "targetStorageType": "distributed-data-model" } }, - "internalId" : "incident_id" + "internalId": "incident_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_incident_instance1.json b/test/integration_test_misc/integration_test_models_instance1/dist_incident_instance1.json index 47672fa6..0e7fcc97 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_incident_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_incident_instance1.json @@ -12,10 +12,11 @@ "associations": { "dist_instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dist_instant", "targetKey": "incident_assoc_id", - "keyIn": "Dist_instant", + "keysIn": "Dist_instant", "targetStorageType": "distributed-data-model" } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_instant.json b/test/integration_test_misc/integration_test_models_instance1/dist_instant.json index 356ec0cd..dbee7c62 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_instant.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_instant.json @@ -1,6 +1,6 @@ { "model": "Dist_instant", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_instant_instance1"], "cassandraRestrictions": true, "attributes": { @@ -16,14 +16,15 @@ "associations": { "dist_incident": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Dist_incident", "targetKey": "incident_assoc_id", - "keyIn" : "Dist_instant", + "keysIn": "Dist_instant", "targetStorageType": "distributed-data-model" } }, - "internalId" : "instant_id" + "internalId": "instant_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_instant_instance1.json b/test/integration_test_misc/integration_test_models_instance1/dist_instant_instance1.json index fcc97e99..fe458359 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_instant_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_instant_instance1.json @@ -16,10 +16,11 @@ "associations": { "dist_incident": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Dist_incident", "targetKey": "incident_assoc_id", - "keyIn": "Dist_instant", + "keysIn": "Dist_instant", "targetStorageType": "distributed-data-model" } diff --git a/test/integration_test_misc/integration_test_models_instance1/dist_reader.json b/test/integration_test_misc/integration_test_models_instance1/dist_reader.json index fae822b8..951a4d0f 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dist_reader.json +++ b/test/integration_test_misc/integration_test_models_instance1/dist_reader.json @@ -1,6 +1,6 @@ { "model": "dist_reader", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_reader_instance1"], "attributes": { "reader_id": "String", @@ -11,5 +11,5 @@ "history": "[String]" }, - "internalId" : "reader_id" + "internalId": "reader_id" } \ No newline at end of file diff --git a/test/integration_test_misc/integration_test_models_instance1/dog.json b/test/integration_test_misc/integration_test_models_instance1/dog.json index a0327b87..00627f6a 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dog.json +++ b/test/integration_test_misc/integration_test_models_instance1/dog.json @@ -1,19 +1,20 @@ { - "model" : "dog", - "storageType" : "distributed-data-model", + "model": "dog", + "storageType": "distributed-data-model", "registry": ["dog_instance1", "dog_instance2"], - "attributes" : { + "attributes": { "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/dog_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance1/dog_instance1_adapter.json index 93f07f8b..462272a4 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dog_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/dog_instance1_adapter.json @@ -1,20 +1,21 @@ { - "model" : "dog", - "storageType" : "sql-adapter", + "model": "dog", + "storageType": "sql-adapter", "adapterName": "dog_instance1", "regex": "instance1", - "attributes" : { + "attributes": { "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/dog_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance1/dog_instance2_adapter.json index b660282a..c3a903a1 100644 --- a/test/integration_test_misc/integration_test_models_instance1/dog_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/dog_instance2_adapter.json @@ -1,21 +1,22 @@ { - "model" : "dog", - "storageType" : "ddm-adapter", + "model": "dog", + "storageType": "ddm-adapter", "adapterName": "dog_instance2", "regex": "instance2", "url": "http://server2:3030/graphql", - "attributes" : { + "attributes": { "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/experiment.json b/test/integration_test_misc/integration_test_models_instance1/experiment.json index edbebebc..29030aca 100644 --- a/test/integration_test_misc/integration_test_models_instance1/experiment.json +++ b/test/integration_test_misc/integration_test_models_instance1/experiment.json @@ -1,7 +1,7 @@ { - "model" : "SequencingExperiment", + "model": "SequencingExperiment", "storageType": "sql", - "attributes":{ + "attributes": { "name": "String", "start_date": "Date", "end_date": "Date", diff --git a/test/integration_test_misc/integration_test_models_instance1/farm.json b/test/integration_test_misc/integration_test_models_instance1/farm.json index 29478a0e..c303f166 100644 --- a/test/integration_test_misc/integration_test_models_instance1/farm.json +++ b/test/integration_test_misc/integration_test_models_instance1/farm.json @@ -8,10 +8,11 @@ }, "associations": { "animals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "animal", "targetKey": "farm_id", - "keyIn": "animal", + "keysIn": "animal", "targetStorageType": "mongodb", "label": "animal_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/food.json b/test/integration_test_misc/integration_test_models_instance1/food.json index 272c86ab..005a14e5 100644 --- a/test/integration_test_misc/integration_test_models_instance1/food.json +++ b/test/integration_test_misc/integration_test_models_instance1/food.json @@ -1,26 +1,26 @@ { - "model" : "food", - "storageType" : "mongodb", - "attributes" : { + "model": "food", + "storageType": "mongodb", + "attributes": { "food_id": "String", "food_name": "String", "animal_ids": "[String]" }, - "associations":{ - "animals":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "associations": { + "animals": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "animal", "targetKey": "food_ids", "sourceKey": "animal_ids", - "keyIn": "food", + "keysIn": "food", "targetStorageType": "mongodb" } }, "internalId": "food_id", - "id":{ + "id": { "name": "food_id", "type": "String" } diff --git a/test/integration_test_misc/integration_test_models_instance1/individual.json b/test/integration_test_misc/integration_test_models_instance1/individual.json index 29357ba9..2a513bf0 100644 --- a/test/integration_test_misc/integration_test_models_instance1/individual.json +++ b/test/integration_test_misc/integration_test_models_instance1/individual.json @@ -1,16 +1,17 @@ { - "model" : "individual", - "storageType" : "SQL", - "attributes" : { - "name" : "String" + "model": "individual", + "storageType": "SQL", + "attributes": { + "name": "String" }, "associations": { "transcript_counts": { - "type" : "to_many", - "target" : "transcript_count", - "targetKey" : "individual_id", - "keyIn": "transcript_count", - "targetStorageType" : "sql" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "transcript_count", + "targetKey": "individual_id", + "keysIn": "transcript_count", + "targetStorageType": "sql" } } } diff --git a/test/integration_test_misc/integration_test_models_instance1/location.json b/test/integration_test_misc/integration_test_models_instance1/location.json index dcf853b0..9acfaeaa 100644 --- a/test/integration_test_misc/integration_test_models_instance1/location.json +++ b/test/integration_test_misc/integration_test_models_instance1/location.json @@ -1,7 +1,7 @@ { "model": "Location", "storageType": "sql", - "attributes" : { + "attributes": { "locationId": "String", "country": "String", "state": "String", @@ -9,18 +9,19 @@ "locality": "String" }, - "associations" :{ + "associations": { "accessions": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Accession", "targetKey": "locationId", - "keyIn": "Accession", + "keysIn": "Accession", "targetStorageType": "sql", "label": "accession_id" } }, - "internalId" : "locationId" + "internalId": "locationId" } diff --git a/test/integration_test_misc/integration_test_models_instance1/measurement.json b/test/integration_test_misc/integration_test_models_instance1/measurement.json index 59155367..681ee940 100644 --- a/test/integration_test_misc/integration_test_models_instance1/measurement.json +++ b/test/integration_test_misc/integration_test_models_instance1/measurement.json @@ -11,14 +11,15 @@ "associations": { "accession": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Accession", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn": "Measurement", "targetStorageType": "sql", "label": "accession_id" } }, - "internalId" : "measurement_id" + "internalId": "measurement_id" } diff --git a/test/integration_test_misc/integration_test_models_instance1/parrot.json b/test/integration_test_misc/integration_test_models_instance1/parrot.json index f838bd00..eb753066 100644 --- a/test/integration_test_misc/integration_test_models_instance1/parrot.json +++ b/test/integration_test_misc/integration_test_models_instance1/parrot.json @@ -1,19 +1,20 @@ { - "model" : "parrot", - "storageType" : "distributed-data-model", + "model": "parrot", + "storageType": "distributed-data-model", "registry": ["parrot_instance1", "parrot_instance2"], - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/parrot_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance1/parrot_instance1_adapter.json index 73d08101..d9325bab 100644 --- a/test/integration_test_misc/integration_test_models_instance1/parrot_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/parrot_instance1_adapter.json @@ -1,20 +1,21 @@ { - "model" : "parrot", - "storageType" : "sql-adapter", + "model": "parrot", + "storageType": "sql-adapter", "adapterName": "parrot_instance1", "regex": "instance1", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/parrot_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance1/parrot_instance2_adapter.json index 39b66a88..152944f0 100644 --- a/test/integration_test_misc/integration_test_models_instance1/parrot_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/parrot_instance2_adapter.json @@ -1,21 +1,22 @@ { - "model" : "parrot", - "storageType" : "ddm-adapter", + "model": "parrot", + "storageType": "ddm-adapter", "adapterName": "parrot_instance2", "regex": "instance2", "url": "http://server2:3030/graphql", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/person.json b/test/integration_test_misc/integration_test_models_instance1/person.json index adc5cbe5..9daf5061 100644 --- a/test/integration_test_misc/integration_test_models_instance1/person.json +++ b/test/integration_test_misc/integration_test_models_instance1/person.json @@ -1,25 +1,27 @@ { - "model" : "person", - "storageType" : "distributed-data-model", + "model": "person", + "storageType": "distributed-data-model", "registry": ["person_instance1", "person_instance2"], - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/person_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance1/person_instance1_adapter.json index fb1557f6..2767744c 100644 --- a/test/integration_test_misc/integration_test_models_instance1/person_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/person_instance1_adapter.json @@ -1,26 +1,28 @@ { - "model" : "person", - "storageType" : "sql-adapter", + "model": "person", + "storageType": "sql-adapter", "adapterName": "person_instance1", "regex": "instance1", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/person_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance1/person_instance2_adapter.json index c709aa46..39d27ab9 100644 --- a/test/integration_test_misc/integration_test_models_instance1/person_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance1/person_instance2_adapter.json @@ -1,27 +1,29 @@ { - "model" : "person", - "storageType" : "ddm-adapter", + "model": "person", + "storageType": "ddm-adapter", "adapterName": "person_instance2", "regex": "instance2", "url": "http://server2:3030/graphql", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/river.json b/test/integration_test_misc/integration_test_models_instance1/river.json index fa73e300..aa2c11a9 100644 --- a/test/integration_test_misc/integration_test_models_instance1/river.json +++ b/test/integration_test_misc/integration_test_models_instance1/river.json @@ -1,30 +1,31 @@ { - "model" : "river", - "storageType" : "SQL", - "attributes" : { - "name" : "String", - "length" : "Int", + "model": "river", + "storageType": "SQL", + "attributes": { + "name": "String", + "length": "Int", "river_id": "String", "city_ids": "[String]" }, "associations": { "countries": { - "type" : "to_many_through_sql_cross_table", + "type": "many_to_many", + "implementation": "sql_cross_table", "target": "country", "sourceKey": "river_id", "targetKey": "country_id", "keysIn": "country_to_river", - "targetStorageType" : "sql" + "targetStorageType": "sql" }, "cities": { - "type": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "city", "targetStorageType": "cassandra", "sourceKey": "city_ids", "targetKey": "river_ids", - "keyIn": "river", - "reverseAssociationType":"to_many" + "keysIn": "river" } }, "internalId": "river_id" diff --git a/test/integration_test_misc/integration_test_models_instance1/sq_author.json b/test/integration_test_misc/integration_test_models_instance1/sq_author.json index fddf4e69..79e6d1b2 100644 --- a/test/integration_test_misc/integration_test_models_instance1/sq_author.json +++ b/test/integration_test_misc/integration_test_models_instance1/sq_author.json @@ -1,22 +1,22 @@ { - "model" : "sq_author", - "storageType" : "sql", + "model": "sq_author", + "storageType": "sql", "database": "default-sql", - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", "email": "String", "book_ids": "[ String ]" }, - "associations":{ - "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "associations": { + "books": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "sql" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/sq_book.json b/test/integration_test_misc/integration_test_models_instance1/sq_book.json index ff0e337f..232962b8 100644 --- a/test/integration_test_misc/integration_test_models_instance1/sq_book.json +++ b/test/integration_test_misc/integration_test_models_instance1/sq_book.json @@ -1,8 +1,8 @@ { - "model" : "sq_book", - "storageType" : "sql", + "model": "sq_book", + "storageType": "sql", "database": "default-sql", - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -10,14 +10,14 @@ "author_ids": "[ String]" }, - "associations":{ - "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "associations": { + "authors": { + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "sq_book", + "keysIn": "sq_book", "targetStorageType": "sql" } }, diff --git a/test/integration_test_misc/integration_test_models_instance1/tracker.json b/test/integration_test_misc/integration_test_models_instance1/tracker.json index 26d158d6..3b31af63 100644 --- a/test/integration_test_misc/integration_test_models_instance1/tracker.json +++ b/test/integration_test_misc/integration_test_models_instance1/tracker.json @@ -1,18 +1,19 @@ { - "model" : "tracker", - "storageType" : "mongodb", - "attributes" : { + "model": "tracker", + "storageType": "mongodb", + "attributes": { "tracker_id": "String", - "animal_id" : "String", + "animal_id": "String", "location": "String" }, "associations": { "unique_animal": { - "type" : "to_one", - "target" : "animal", - "targetKey" : "animal_id", - "keyIn": "tracker", - "targetStorageType" : "mongodb" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "animal", + "targetKey": "animal_id", + "keysIn": "tracker", + "targetStorageType": "mongodb" } }, "internalId": "tracker_id", diff --git a/test/integration_test_misc/integration_test_models_instance1/transcript_count.json b/test/integration_test_misc/integration_test_models_instance1/transcript_count.json index 65a297e9..744a432b 100644 --- a/test/integration_test_misc/integration_test_models_instance1/transcript_count.json +++ b/test/integration_test_misc/integration_test_models_instance1/transcript_count.json @@ -1,28 +1,30 @@ { - "model" : "transcript_count", - "storageType" : "SQL", - "attributes" : { - "gene" : "String", - "variable" : "String", - "count" : "Float", + "model": "transcript_count", + "storageType": "SQL", + "attributes": { + "gene": "String", + "variable": "String", + "count": "Float", "tissue_or_condition": "String", "individual_id": "Int", "aminoacidsequence_id": "Int" }, - "associations":{ - "individual":{ - "type" : "to_one", - "target" : "individual", - "targetKey" : "individual_id", - "keyIn": "transcript_count", - "targetStorageType" : "sql" + "associations": { + "individual": { + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "individual", + "targetKey": "individual_id", + "keysIn": "transcript_count", + "targetStorageType": "sql" }, - "aminoacidsequence":{ - "type" : "to_one", - "target" : "aminoacidsequence", - "targetKey" : "aminoacidsequence_id", - "keyIn": "transcript_count", - "targetStorageType" : "generic" + "aminoacidsequence": { + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "aminoacidsequence", + "targetKey": "aminoacidsequence_id", + "keysIn": "transcript_count", + "targetStorageType": "generic" } } } diff --git a/test/integration_test_misc/integration_test_models_instance2/accession.json b/test/integration_test_misc/integration_test_models_instance2/accession.json index 14de440d..61ea24ca 100644 --- a/test/integration_test_misc/integration_test_models_instance2/accession.json +++ b/test/integration_test_misc/integration_test_models_instance2/accession.json @@ -13,24 +13,26 @@ "associations": { "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn": "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn": "Measurement", "targetStorageType": "sql", "label": "name" } }, - "internalId" : "accession_id" + "internalId": "accession_id" } diff --git a/test/integration_test_misc/integration_test_models_instance2/actor.json b/test/integration_test_misc/integration_test_models_instance2/actor.json index ab42dfae..ce7fde3c 100644 --- a/test/integration_test_misc/integration_test_models_instance2/actor.json +++ b/test/integration_test_misc/integration_test_models_instance2/actor.json @@ -9,12 +9,12 @@ "associations":{ "movies":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "movie", "targetKey": "actor_ids", "sourceKey": "movie_ids", - "keyIn": "actor", + "keysIn": "actor", "targetStorageType": "neo4j" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/author.json b/test/integration_test_misc/integration_test_models_instance2/author.json index 9e8d3904..261dc9d8 100644 --- a/test/integration_test_misc/integration_test_models_instance2/author.json +++ b/test/integration_test_misc/integration_test_models_instance2/author.json @@ -1,8 +1,8 @@ { - "model" : "author", - "storageType" : "zendro-server", + "model": "author", + "storageType": "zendro-server", "url": "http://server1:3000/graphql", - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", @@ -12,12 +12,12 @@ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "author", + "keysIn": "author", "targetStorageType": "zendro-server" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/book.json b/test/integration_test_misc/integration_test_models_instance2/book.json index f8cdf101..1625a50a 100644 --- a/test/integration_test_misc/integration_test_models_instance2/book.json +++ b/test/integration_test_misc/integration_test_models_instance2/book.json @@ -1,8 +1,8 @@ { - "model" : "book", - "storageType" : "zendro-server", + "model": "book", + "storageType": "zendro-server", "url": "http://server1:3000/graphql", - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -12,12 +12,12 @@ "associations":{ "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "book", + "keysIn": "book", "targetStorageType": "zendro-server" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/director.json b/test/integration_test_misc/integration_test_models_instance2/director.json index c5a1d2e8..993d63ac 100644 --- a/test/integration_test_misc/integration_test_models_instance2/director.json +++ b/test/integration_test_misc/integration_test_models_instance2/director.json @@ -8,10 +8,11 @@ }, "associations": { "movies": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "movie", "targetKey": "director_id", - "keyIn": "movie", + "keysIn": "movie", "targetStorageType": "neo4j", "label": "movie_id" } diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_director.json b/test/integration_test_misc/integration_test_models_instance2/dist_director.json index 8654b523..592c47da 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_director.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_director.json @@ -9,10 +9,11 @@ }, "associations": { "dist_movies": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "dist_movie", "targetKey": "director_id", - "keyIn": "dist_movie", + "keysIn": "dist_movie", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_director_instance1.json b/test/integration_test_misc/integration_test_models_instance2/dist_director_instance1.json index 776f86bd..a5b47120 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_director_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_director_instance1.json @@ -10,10 +10,11 @@ }, "associations": { "dist_movies": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "dist_movie", "targetKey": "director_id", - "keyIn": "dist_movie", + "keysIn": "dist_movie", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_movie.json b/test/integration_test_misc/integration_test_models_instance2/dist_movie.json index 3d9a93fa..b0b36f27 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_movie.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_movie.json @@ -15,10 +15,11 @@ "associations": { "dist_director": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "dist_director", "targetKey": "director_id", - "keyIn" : "dist_movie", + "keysIn" : "dist_movie", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_movie_instance1.json b/test/integration_test_misc/integration_test_models_instance2/dist_movie_instance1.json index 5816349a..8811d324 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_movie_instance1.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_movie_instance1.json @@ -15,10 +15,11 @@ }, "associations": { "dist_director": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "dist_director", "targetKey": "director_id", - "keyIn": "dist_movie", + "keysIn": "dist_movie", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_presto_doctor.json b/test/integration_test_misc/integration_test_models_instance2/dist_presto_doctor.json index 116062c8..8339a2e5 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_presto_doctor.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_presto_doctor.json @@ -1,6 +1,6 @@ { "model": "dist_presto_doctor", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_presto_doctor_instance1"], "attributes": { "doctor_id": "String", @@ -12,5 +12,5 @@ "telephone": "[Int]" }, - "internalId" : "doctor_id" + "internalId": "doctor_id" } \ No newline at end of file diff --git a/test/integration_test_misc/integration_test_models_instance2/dist_trino_doctor.json b/test/integration_test_misc/integration_test_models_instance2/dist_trino_doctor.json index 3d4815aa..29993258 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dist_trino_doctor.json +++ b/test/integration_test_misc/integration_test_models_instance2/dist_trino_doctor.json @@ -1,6 +1,6 @@ { "model": "dist_trino_doctor", - "storageType" : "distributed-data-model", + "storageType": "distributed-data-model", "registry": ["dist_trino_doctor_instance1"], "attributes": { "doctor_id": "String", @@ -12,5 +12,5 @@ "telephone": "[Int]" }, - "internalId" : "doctor_id" + "internalId": "doctor_id" } \ No newline at end of file diff --git a/test/integration_test_misc/integration_test_models_instance2/dog.json b/test/integration_test_misc/integration_test_models_instance2/dog.json index a0327b87..f354c1cb 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dog.json +++ b/test/integration_test_misc/integration_test_models_instance2/dog.json @@ -1,19 +1,20 @@ { - "model" : "dog", - "storageType" : "distributed-data-model", + "model": "dog", + "storageType": "distributed-data-model", "registry": ["dog_instance1", "dog_instance2"], - "attributes" : { - "name": "String", + "attributes": { + "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/dog_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance2/dog_instance1_adapter.json index 5515ae55..a57a7931 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dog_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/dog_instance1_adapter.json @@ -1,21 +1,22 @@ { - "model" : "dog", - "storageType" : "ddm-adapter", + "model": "dog", + "storageType": "ddm-adapter", "adapterName": "dog_instance1", "regex": "instance1", "url": "http://server1:3000/graphql", - "attributes" : { - "name": "String", + "attributes": { + "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/dog_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance2/dog_instance2_adapter.json index 1526a9ca..73f90529 100644 --- a/test/integration_test_misc/integration_test_models_instance2/dog_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/dog_instance2_adapter.json @@ -1,20 +1,21 @@ { - "model" : "dog", - "storageType" : "sql-adapter", + "model": "dog", + "storageType": "sql-adapter", "adapterName": "dog_instance2", "regex": "instance2", - "attributes" : { - "name": "String", + "attributes": { + "name": "String", "dog_id": "String", "person_id": "String" }, "associations": { "person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "many_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" } }, "internalId": "dog_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/location.json b/test/integration_test_misc/integration_test_models_instance2/location.json index b20b1c1a..b0cce4f8 100644 --- a/test/integration_test_misc/integration_test_models_instance2/location.json +++ b/test/integration_test_misc/integration_test_models_instance2/location.json @@ -2,7 +2,7 @@ "model": "Location", "storageType": "zendro-server", "url": "http://server1:3000/graphql", - "attributes" : { + "attributes": { "locationId": "String", "country": "String", "state": "String", @@ -13,15 +13,16 @@ "associations" :{ "accessions": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Accession", "targetKey": "locationId", - "keyIn": "Accession", + "keysIn": "Accession", "targetStorageType": "sql", "label": "accession_id" } }, - "internalId" : "locationId" + "internalId": "locationId" } diff --git a/test/integration_test_misc/integration_test_models_instance2/measurement.json b/test/integration_test_misc/integration_test_models_instance2/measurement.json index c44be5a2..d6899c8d 100644 --- a/test/integration_test_misc/integration_test_models_instance2/measurement.json +++ b/test/integration_test_misc/integration_test_models_instance2/measurement.json @@ -12,14 +12,15 @@ "associations": { "accession": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Accession", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn": "Measurement", "targetStorageType": "sql", "label": "accession_id" } }, - "internalId" : "measurement_id" + "internalId": "measurement_id" } diff --git a/test/integration_test_misc/integration_test_models_instance2/movie.json b/test/integration_test_misc/integration_test_models_instance2/movie.json index a06dca5d..b76f449a 100644 --- a/test/integration_test_misc/integration_test_models_instance2/movie.json +++ b/test/integration_test_misc/integration_test_models_instance2/movie.json @@ -14,27 +14,29 @@ }, "associations": { "director": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "director", "targetKey": "director_id", - "keyIn": "movie", + "keysIn": "movie", "targetStorageType": "neo4j", "label": "director_name" }, "actor":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "actor", "targetKey": "movie_ids", "sourceKey": "actor_ids", - "keyIn": "movie", + "keysIn": "movie", "targetStorageType": "neo4j" }, "unique_review":{ - "type" : "to_one", + "type" : "one_to_one", + "implementation": "foreignkeys", "target" : "review", "targetKey" : "movie_id", - "keyIn": "tracker", + "keysIn": "tracker", "targetStorageType" : "neo4j" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/parrot.json b/test/integration_test_misc/integration_test_models_instance2/parrot.json index f838bd00..eb753066 100644 --- a/test/integration_test_misc/integration_test_models_instance2/parrot.json +++ b/test/integration_test_misc/integration_test_models_instance2/parrot.json @@ -1,19 +1,20 @@ { - "model" : "parrot", - "storageType" : "distributed-data-model", + "model": "parrot", + "storageType": "distributed-data-model", "registry": ["parrot_instance1", "parrot_instance2"], - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/parrot_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance2/parrot_instance1_adapter.json index 4d0b8aad..bdc6200f 100644 --- a/test/integration_test_misc/integration_test_models_instance2/parrot_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/parrot_instance1_adapter.json @@ -1,21 +1,22 @@ { - "model" : "parrot", - "storageType" : "ddm-adapter", + "model": "parrot", + "storageType": "ddm-adapter", "adapterName": "parrot_instance1", "regex": "instance1", "url": "http://server1:3000/graphql", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/parrot_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance2/parrot_instance2_adapter.json index d099d1ea..dc8903e0 100644 --- a/test/integration_test_misc/integration_test_models_instance2/parrot_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/parrot_instance2_adapter.json @@ -1,20 +1,21 @@ { - "model" : "parrot", - "storageType" : "sql-adapter", + "model": "parrot", + "storageType": "sql-adapter", "adapterName": "parrot_instance2", "regex": "instance2", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "parrot_id": "String", "person_id": "String" }, "associations": { "unique_person": { - "type" : "to_one", - "target" : "person", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "person", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "parrot_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/person.json b/test/integration_test_misc/integration_test_models_instance2/person.json index adc5cbe5..9daf5061 100644 --- a/test/integration_test_misc/integration_test_models_instance2/person.json +++ b/test/integration_test_misc/integration_test_models_instance2/person.json @@ -1,25 +1,27 @@ { - "model" : "person", - "storageType" : "distributed-data-model", + "model": "person", + "storageType": "distributed-data-model", "registry": ["person_instance1", "person_instance2"], - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/person_instance1_adapter.json b/test/integration_test_misc/integration_test_models_instance2/person_instance1_adapter.json index eb908d1e..bb56388f 100644 --- a/test/integration_test_misc/integration_test_models_instance2/person_instance1_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/person_instance1_adapter.json @@ -1,27 +1,29 @@ { - "model" : "person", - "storageType" : "ddm-adapter", + "model": "person", + "storageType": "ddm-adapter", "adapterName": "person_instance1", "regex": "instance1", "url": "http://server1:3000/graphql", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/person_instance2_adapter.json b/test/integration_test_misc/integration_test_models_instance2/person_instance2_adapter.json index a4ef9421..698341c9 100644 --- a/test/integration_test_misc/integration_test_models_instance2/person_instance2_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/person_instance2_adapter.json @@ -1,26 +1,28 @@ { - "model" : "person", - "storageType" : "sql-adapter", + "model": "person", + "storageType": "sql-adapter", "adapterName": "person_instance2", "regex": "instance2", - "attributes" : { - "name" : "String", + "attributes": { + "name": "String", "person_id": "String" }, "associations": { "dogs": { - "type" : "to_many", - "target" : "dog", - "targetKey" : "person_id", - "keyIn": "dog", - "targetStorageType" : "distributed-data-model" + "type": "one_to_many", + "implementation": "foreignkeys", + "target": "dog", + "targetKey": "person_id", + "keysIn": "dog", + "targetStorageType": "distributed-data-model" }, "unique_parrot": { - "type" : "to_one", - "target" : "parrot", - "targetKey" : "person_id", - "keyIn": "parrot", - "targetStorageType" : "distributed-data-model" + "type": "one_to_one", + "implementation": "foreignkeys", + "target": "parrot", + "targetKey": "person_id", + "keysIn": "parrot", + "targetStorageType": "distributed-data-model" } }, "internalId": "person_id" diff --git a/test/integration_test_misc/integration_test_models_instance2/review.json b/test/integration_test_misc/integration_test_models_instance2/review.json index 2c5006da..16f54086 100644 --- a/test/integration_test_misc/integration_test_models_instance2/review.json +++ b/test/integration_test_misc/integration_test_models_instance2/review.json @@ -8,10 +8,11 @@ }, "associations": { "unique_movie": { - "type" : "to_one", + "type" : "one_to_one", + "implementation": "foreignkeys", "target" : "movie", "targetKey" : "movie_id", - "keyIn": "review", + "keysIn": "review", "targetStorageType" : "neo4j" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_author_adapter.json b/test/integration_test_misc/integration_test_models_instance2/sq_author_adapter.json index f7bd485c..03f834b6 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_author_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_author_adapter.json @@ -1,9 +1,9 @@ { - "model" : "sq_author", - "storageType" : "sql-adapter", + "model": "sq_author", + "storageType": "sql-adapter", "adapterName": "author_local", "regex": "local", - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", @@ -13,12 +13,12 @@ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_author_ddm.json b/test/integration_test_misc/integration_test_models_instance2/sq_author_ddm.json index 2e6c8655..057a1adf 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_author_ddm.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_author_ddm.json @@ -1,8 +1,8 @@ { - "model" : "sq_author", - "storageType" : "distributed-data-model", + "model": "sq_author", + "storageType": "distributed-data-model", "registry": ["author_remote","author_local"], - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", @@ -12,12 +12,12 @@ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_author_zendro_adapter.json b/test/integration_test_misc/integration_test_models_instance2/sq_author_zendro_adapter.json index d3cc230f..46c121e4 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_author_zendro_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_author_zendro_adapter.json @@ -1,10 +1,10 @@ { - "model" : "sq_author", - "storageType" : "zendro-webservice-adapter", + "model": "sq_author", + "storageType": "zendro-webservice-adapter", "adapterName": "author_remote", "regex": "remote", "url": "http://server1:3000/graphql", - "attributes" : { + "attributes": { "id": "String", "name": "String", "lastname": "String", @@ -14,12 +14,12 @@ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_book_adapter.json b/test/integration_test_misc/integration_test_models_instance2/sq_book_adapter.json index d6d8a44a..6a36f9b6 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_book_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_book_adapter.json @@ -1,9 +1,9 @@ { - "model" : "sq_book", - "storageType" : "sql-adapter", + "model": "sq_book", + "storageType": "sql-adapter", "adapterName": "book_local", "regex": "local", - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -13,12 +13,12 @@ "associations":{ "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "sq_book", + "keysIn": "sq_book", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_book_ddm.json b/test/integration_test_misc/integration_test_models_instance2/sq_book_ddm.json index e93f0bbd..59b38fa4 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_book_ddm.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_book_ddm.json @@ -1,8 +1,8 @@ { - "model" : "sq_book", - "storageType" : "distributed-data-model", + "model": "sq_book", + "storageType": "distributed-data-model", "registry": ["book_remote","book_local"], - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -12,12 +12,12 @@ "associations":{ "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "sq_book", + "keysIn": "sq_book", "targetStorageType": "distributed-data-model" } }, diff --git a/test/integration_test_misc/integration_test_models_instance2/sq_book_zendro_adapter.json b/test/integration_test_misc/integration_test_models_instance2/sq_book_zendro_adapter.json index 430606da..607bd833 100644 --- a/test/integration_test_misc/integration_test_models_instance2/sq_book_zendro_adapter.json +++ b/test/integration_test_misc/integration_test_models_instance2/sq_book_zendro_adapter.json @@ -1,10 +1,10 @@ { - "model" : "sq_book", - "storageType" : "zendro-webservice-adapter", + "model": "sq_book", + "storageType": "zendro-webservice-adapter", "adapterName": "book_remote", "regex": "remote", "url": "http://server1:3000/graphql", - "attributes" : { + "attributes": { "id": "String", "title": "String", "genre": "String", @@ -14,12 +14,12 @@ "associations":{ "authors":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_author", "targetKey": "book_ids", "sourceKey": "author_ids", - "keyIn": "sq_book", + "keysIn": "sq_book", "targetStorageType": "distributed-data-model" } }, diff --git a/test/mocha_unit.test.js b/test/mocha_unit.test.js index 46ea0322..c9bd4299 100644 --- a/test/mocha_unit.test.js +++ b/test/mocha_unit.test.js @@ -1355,11 +1355,12 @@ describe("Parse associations", function () { }, to_one: [ { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "individual", targetKey: "individual_id", targetKey_cp: "Individual_id", - keyIn: "transcript_count", + keysIn: "transcript_count", targetStorageType: "sql", name: "individual", name_lc: "individual", @@ -1369,9 +1370,10 @@ describe("Parse associations", function () { target_pl: "individuals", target_cp: "Individual", target_cp_pl: "Individuals", - keyIn_lc: "transcript_count", + keysIn_lc: "transcript_count", holdsForeignKey: true, assocThroughArray: false, + reverseAssociation: undefined, }, ], to_many: [], @@ -1383,10 +1385,11 @@ describe("Parse associations", function () { }, associations: [ { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "individual", targetKey: "individual_id", - keyIn: "transcript_count", + keysIn: "transcript_count", targetStorageType: "sql", }, ], @@ -1413,9 +1416,10 @@ describe("Parse associations", function () { to_one: [], to_many: [ { - type: "to_many", + type: "one_to_many", + implementation: "foreignkeys", target: "transcript_count", - keyIn: "transcript_count", + keysIn: "transcript_count", targetKey: "individual_id", targetKey_cp: "Individual_id", targetStorageType: "sql", @@ -1427,9 +1431,10 @@ describe("Parse associations", function () { target_pl: "transcript_counts", target_cp: "Transcript_count", target_cp_pl: "Transcript_counts", - keyIn_lc: "transcript_count", + keysIn_lc: "transcript_count", holdsForeignKey: false, assocThroughArray: false, + reverseAssociation: undefined, }, ], to_many_through_sql_cross_table: [], @@ -1440,9 +1445,10 @@ describe("Parse associations", function () { }, associations: [ { - type: "to_many", + type: "one_to_many", + implementation: "foreignkeys", target: "transcript_count", - keyIn: "transcript_count", + keysIn: "transcript_count", targetKey: "individual_id", targetStorageType: "sql", }, @@ -1454,7 +1460,7 @@ describe("Parse associations", function () { it("03. Single to_many_through_sql_cross_table", function () { let association = models.assoc_through_project_researcher; - association.type = "to_many_through_sql_cross_table"; + // association.type = "many_to_many"; let model = { model: "Person", associations: { assoc: association } }; let res = funks.parseAssociations(model, "sql"); expect(res).to.deep.equal({ @@ -1470,12 +1476,14 @@ describe("Parse associations", function () { to_many: [], to_many_through_sql_cross_table: [ { - type: "to_many_through_sql_cross_table", + type: "many_to_many", + implementation: "sql_cross_table", target: "Project", targetKey: "projectId", targetKey_cp: "ProjectId", sourceKey: "researcherId", keysIn: "project_to_researcher", + keysIn_lc: "project_to_researcher", targetStorageType: "sql", source: "researchers", target_lc: "project", @@ -1488,6 +1496,7 @@ describe("Parse associations", function () { name_cp: "Assoc", holdsForeignKey: false, assocThroughArray: false, + reverseAssociation: undefined, }, ], generic_to_one: [], @@ -1497,7 +1506,8 @@ describe("Parse associations", function () { }, associations: [ { - type: "to_many_through_sql_cross_table", + type: "many_to_many", + implementation: "sql_cross_table", target: "Project", targetKey: "projectId", sourceKey: "researcherId", @@ -1518,7 +1528,7 @@ describe("Parse associations", function () { it("04. Two associations: to_many and to_many_through_sql_cross_table", function () { let person = models.person; - person.associations.books.type = "to_many_through_sql_cross_table"; + // person.associations.books.type = "to_many_through_sql_cross_table"; let res = funks.parseAssociations(person, "sql"); expect(res).to.deep.equal({ schema_attributes: { @@ -1533,11 +1543,12 @@ describe("Parse associations", function () { to_one: [], to_many: [ { - type: "to_many", + type: "one_to_many", + implementation: "foreignkeys", target: "Dog", targetKey: "personId", targetKey_cp: "PersonId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", name: "dogs", name_lc: "dogs", @@ -1547,19 +1558,22 @@ describe("Parse associations", function () { target_pl: "Dogs", target_cp: "Dog", target_cp_pl: "Dogs", - keyIn_lc: "dog", + keysIn_lc: "dog", holdsForeignKey: false, assocThroughArray: false, + reverseAssociation: undefined, }, ], to_many_through_sql_cross_table: [ { - type: "to_many_through_sql_cross_table", + type: "many_to_many", + implementation: "sql_cross_table", target: "Book", targetKey: "bookId", targetKey_cp: "BookId", sourceKey: "personId", keysIn: "books_to_people", + keysIn_lc: "books_to_people", targetStorageType: "sql", name: "books", name_lc: "books", @@ -1571,6 +1585,7 @@ describe("Parse associations", function () { target_cp_pl: "Books", holdsForeignKey: false, assocThroughArray: false, + reverseAssociation: undefined, }, ], generic_to_one: [], @@ -1581,14 +1596,16 @@ describe("Parse associations", function () { }, associations: [ { - type: "to_many", + type: "one_to_many", + implementation: "foreignkeys", target: "Dog", targetKey: "personId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", }, { - type: "to_many_through_sql_cross_table", + type: "many_to_many", + implementation: "sql_cross_table", target: "Book", targetKey: "bookId", sourceKey: "personId", @@ -1615,11 +1632,12 @@ describe("Parse associations", function () { }, to_one: [ { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "Person", targetKey: "personId", targetKey_cp: "PersonId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", label: "firstName", sublabel: "lastName", @@ -1631,16 +1649,18 @@ describe("Parse associations", function () { target_pl: "People", target_cp: "Person", target_cp_pl: "People", - keyIn_lc: "dog", + keysIn_lc: "dog", holdsForeignKey: true, assocThroughArray: false, + reverseAssociation: undefined, }, { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "Researcher", targetKey: "researcherId", targetKey_cp: "ResearcherId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", label: "firstName", name: "researcher", @@ -1651,9 +1671,10 @@ describe("Parse associations", function () { target_pl: "Researchers", target_cp: "Researcher", target_cp_pl: "Researchers", - keyIn_lc: "dog", + keysIn_lc: "dog", holdsForeignKey: true, assocThroughArray: false, + reverseAssociation: undefined, }, ], to_many: [], @@ -1666,19 +1687,21 @@ describe("Parse associations", function () { }, associations: [ { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "Person", targetKey: "personId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", label: "firstName", sublabel: "lastName", }, { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "Researcher", targetKey: "researcherId", - keyIn: "Dog", + keysIn: "Dog", targetStorageType: "sql", label: "firstName", }, diff --git a/test/unit_test_misc/data_models.js b/test/unit_test_misc/data_models.js index 4981f8f9..c0ad755c 100644 --- a/test/unit_test_misc/data_models.js +++ b/test/unit_test_misc/data_models.js @@ -10,10 +10,11 @@ module.exports.transcript_count = { }, "associations":{ "individual":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "individual", "targetKey" : "individual_id", - "keyIn": "transcript_count", + "keysIn": "transcript_count", "targetStorageType" : "sql" } } @@ -27,9 +28,10 @@ module.exports.individual = { }, "associations": { "transcript_counts": { - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "transcript_count", - "keyIn": "transcript_count", + "keysIn": "transcript_count", "targetKey" : "individual_id", "targetStorageType" : "sql" } @@ -65,15 +67,17 @@ module.exports.person = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -94,7 +98,8 @@ module.exports.book = { "associations":{ "people" : { - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Person", "targetKey" : "personId", "sourceKey" : "bookId", @@ -102,10 +107,11 @@ module.exports.book = { "targetStorageType" : "sql" }, "publisher" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Publisher", "targetKey" : "publisherId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType" : "generic" } } @@ -121,7 +127,8 @@ module.exports.researcher = { }, "associations":{ "projects":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Project", "targetKey" : "projectId", "sourceKey" : "researcherId", @@ -129,10 +136,11 @@ module.exports.researcher = { "targetStorageType" : "sql" }, "dog":{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Dog", "targetKey": "researcherId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "sql" } } @@ -150,10 +158,11 @@ module.exports.specie = { "associations":{ "projects" : { - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Project", "targetKey" : "specieId", - "keyIn": "Project", + "keysIn": "Project", "targetStorageType" : "sql" } } @@ -169,19 +178,21 @@ module.exports.dog = { "associations" : { "person" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "firstName", "sublabel": "lastName" }, "researcher":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target": "Researcher", "targetKey": "researcherId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "SQL", "label": "firstName" } @@ -189,7 +200,8 @@ module.exports.dog = { } module.exports.assoc_through_project_researcher = { - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Project", "targetKey" : "projectId", "sourceKey" : "researcherId", @@ -204,10 +216,11 @@ module.exports.assoc_through_project_researcher = { } module.exports.assoc_dogs_researcher = { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target": "Researcher", "targetKey": "researcherId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "SQL", "target_lc": "researcher", "target_lc_pl": "researchers", @@ -236,10 +249,11 @@ module.exports.inDiVIdual_camelcase = { }, "associations": { "transcriptCounts": { - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "transcriptCount", "targetKey" : "individual_id", - "keyIn": "transcriptCount", + "keysIn": "transcriptCount", "targetStorageType" : "sql", "label" : "gene", "sublabel" : "variable" @@ -259,10 +273,11 @@ module.exports.transcriptCount_camelcase = { }, "associations":{ "inDiVIdual":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "inDiVIdual", "targetKey" : "individual_id", - "keyIn": "transcriptCount", + "keysIn": "transcriptCount", "targetStorageType" : "sql", "label" : "name" } @@ -280,10 +295,11 @@ module.exports.transcriptCount_indiv= { }, "associations":{ "individual":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Individual", "targetKey" : "individual_id", - "keyIn": "transcriptCount", + "keysIn": "transcriptCount", "targetStorageType" : "sql", "label" : "name" } @@ -302,19 +318,21 @@ module.exports.dog_owner = { "associations" : { "owner" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "owner_id_test", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "firstName", "sublabel": "lastName" }, "keeper":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target": "Researcher", "targetKey": "keeperId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "SQL", "label": "firstName" } @@ -332,16 +350,18 @@ module.exports.person_indices = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "name" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -365,16 +385,18 @@ module.exports.person_externalIds = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "name" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -398,10 +420,11 @@ module.exports.academicTeam = { }, "associations":{ "members":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Researcher", "targetKey" : "academicTeamId", - "keyIn": "Researcher", + "keysIn": "Researcher", "targetStorageType" : "sql", "label": "firstName", "sublabel": "lastName" @@ -421,25 +444,28 @@ module.exports.person_date = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "name" }, "patients":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "doctor_Id", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "name" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "book_Id", "sourceKey" : "person_Id", @@ -462,7 +488,8 @@ module.exports.book_authors = { "associations":{ "Authors" : { - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Person", "targetKey" : "person_Id", "sourceKey" : "book_Id", @@ -472,10 +499,11 @@ module.exports.book_authors = { "sublabel" : "email" }, "publisher" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Publisher", "targetKey" : "publisherId", - "keyIn" : "Book", + "keysIn" : "Book", "targetStorageType" : "generic", "label" : "name" } @@ -498,15 +526,17 @@ module.exports.person_description = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -531,15 +561,17 @@ module.exports.person_description_optional = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql" }, "books":{ - "type" : "to_many_through_sql_cross_table", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -560,10 +592,11 @@ module.exports.academic_Team = { }, "associations":{ "members":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Researcher", "targetKey" : "AcademicTeam_Id", - "keyIn": "Researcher", + "keysIn": "Researcher", "targetStorageType" : "sql" } } @@ -581,10 +614,11 @@ module.exports.dog_one_assoc = { "associations" : { "owner" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "personId", - "keyIn" : "Dog", + "keysIn" : "Dog", "targetStorageType" : "sql" } } @@ -602,10 +636,11 @@ module.exports.person_one_assoc = { "associations" : { "unique_pet" :{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Dog", "targetKey": "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "sql" } } @@ -623,10 +658,11 @@ module.exports.book_extendedIds = { }, "associations": { "author": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Person", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "sql", "label": "email" } @@ -648,12 +684,12 @@ module.exports.author_foreignKeyArray = { "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "author", + "keysIn": "author", "targetStorageType": "sql" } }, @@ -675,12 +711,12 @@ module.exports.author_zendro_remote = { "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "post_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "post_author", + "keysIn": "post_author", "targetStorageType": "zendro-server" } }, @@ -701,12 +737,12 @@ module.exports.author_ddm_array_fk ={ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, @@ -728,12 +764,12 @@ module.exports.author_sql_adapter_array_fk ={ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, @@ -757,12 +793,12 @@ module.exports.author_zendro_adapter_array_fk ={ "associations":{ "books":{ - "type": "to_many", - "reverseAssociationType": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "sq_book", "targetKey": "author_ids", "sourceKey": "book_ids", - "keyIn": "sq_author", + "keysIn": "sq_author", "targetStorageType": "distributed-data-model" } }, diff --git a/test/unit_test_misc/data_models_cassandra.js b/test/unit_test_misc/data_models_cassandra.js index c87095cd..7f81f515 100644 --- a/test/unit_test_misc/data_models_cassandra.js +++ b/test/unit_test_misc/data_models_cassandra.js @@ -15,13 +15,13 @@ module.exports.city = { }, "associations": { "rivers": { - "type": "to_many", + "type": "many_to_many", + "implementation": "foreignkeys", "target": "river", "targetStorageType": "sql", "sourceKey": "river_ids", "targetKey": "city_ids", - "keyIn": "city", - "reverseAssociationType": "to_many" + "keysIn": "city", } }, "internalId": "city_id" @@ -40,17 +40,19 @@ module.exports.incident = { "associations": { "instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Instant", "targetKey": "incident_assoc_id", - "keyIn" : "Instant", + "keysIn" : "Instant", "targetStorageType": "cassandra" }, "town": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "capital", "targetKey": "capital_id", - "keyIn" : "Incident", + "keysIn" : "Incident", "targetStorageType": "sql" } @@ -73,10 +75,11 @@ module.exports.dist_incident = { "associations": { "dist_instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dist_instant", "targetKey": "incident_assoc_id", - "keyIn" : "Dist_instant", + "keysIn" : "Dist_instant", "targetStorageType": "distributed-data-model" } @@ -99,10 +102,11 @@ module.exports.dist_instant_instance1 = { "associations": { "dist_instants": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dist_instant", "targetKey": "incident_assoc_id", - "keyIn": "Dist_instant", + "keysIn": "Dist_instant", "targetStorageType": "distributed-data-model" } diff --git a/test/unit_test_misc/data_models_distributed.js b/test/unit_test_misc/data_models_distributed.js index f45fad90..89a4c349 100644 --- a/test/unit_test_misc/data_models_distributed.js +++ b/test/unit_test_misc/data_models_distributed.js @@ -12,7 +12,8 @@ module.exports.book = { "associations":{ "Authors" : { - "type" : "to_many", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Person", "targetKey" : "personId", "sourceKey" : "bookId", @@ -22,10 +23,11 @@ module.exports.book = { "sublabel" : "email" }, "publisher" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "publi_sher", "targetKey" : "publisher_id", - "keyIn" : "Book", + "keysIn" : "Book", "targetStorageType" : "zendro-server", "label" : "name" } @@ -46,7 +48,8 @@ module.exports.book_ddm = "associations":{ "Authors" : { - "type" : "to_many", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Person", "targetKey" : "personId", "sourceKey" : "bookId", @@ -56,10 +59,11 @@ module.exports.book_ddm = "sublabel" : "email" }, "publisher" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "publi_sher", "targetKey" : "publisher_id", - "keyIn" : "Book", + "keysIn" : "Book", "targetStorageType" : "zendro-server", "label" : "name" } @@ -80,7 +84,8 @@ module.exports.person_ddm = { "associations" : { "works" : { - "type": "to_many", + "type": "many_to_many", + "implementation": "sql_cross_table", "target": "Book", "targetKey": "bookId", "sourceKey": "personId", @@ -89,26 +94,29 @@ module.exports.person_ddm = { }, "company":{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "publi_sher", "targetKey": "companyId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType": "zendro-server" }, "dogs" :{ - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dog", "targetKey": "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "sql" }, "parrot" :{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Parrot", "targetKey": "personId", - "keyIn": "Parrot", + "keysIn": "Parrot", "targetStorageType": "sql" }, } @@ -128,10 +136,11 @@ module.exports.dog_ddm = { "associations" : { "owner" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "personId", - "keyIn" : "Dog", + "keysIn" : "Dog", "targetStorageType" : "sql" } } @@ -153,10 +162,11 @@ module.exports.dog_ddm = { }, "associations": { "works": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Book", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "sql", "label": "title" } @@ -199,10 +209,11 @@ module.exports.dog_ddm = { }, "associations": { "author": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Person", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "zendro-server", "label": "email" } @@ -221,10 +232,11 @@ module.exports.dog_ddm_integration_test = { }, "associations": { "person": { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "person", "targetKey" : "person_id", - "keyIn": "dog", + "keysIn": "dog", "targetStorageType" : "distributed-data-model" } }, @@ -246,10 +258,11 @@ module.exports.dog_zendro_adapter_integration_test = }, "associations": { "person": { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "person", "targetKey" : "person_id", - "keyIn": "dog", + "keysIn": "dog", "targetStorageType" : "distributed-data-model" } }, diff --git a/test/unit_test_misc/data_models_extendedId.js b/test/unit_test_misc/data_models_extendedId.js index f797a201..1080e3d6 100644 --- a/test/unit_test_misc/data_models_extendedId.js +++ b/test/unit_test_misc/data_models_extendedId.js @@ -12,10 +12,11 @@ module.exports.book_adapter = { }, "associations": { "author": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Person", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "sql", "label": "email" } @@ -38,10 +39,11 @@ module.exports.book_ddm = { }, "associations": { "author": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Person", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "zendro-server", "label": "email" } @@ -64,10 +66,11 @@ module.exports.person_adapter = { }, "associations": { "works": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Book", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "sql", "label": "title" } @@ -91,10 +94,11 @@ module.exports.person_ddm = { }, "associations": { "works": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Book", "targetKey": "internalPersonId", - "keyIn": "Book", + "keysIn": "Book", "targetStorageType": "zendro-server", "label": "title" } diff --git a/test/unit_test_misc/data_models_generic.js b/test/unit_test_misc/data_models_generic.js index a89f0cbe..2ab8f97f 100644 --- a/test/unit_test_misc/data_models_generic.js +++ b/test/unit_test_misc/data_models_generic.js @@ -22,10 +22,11 @@ module.exports.personSql_toMany_dogGeneric = { }, "associations":{ "dogs":{ - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Dog", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "generic", "label": "name" } @@ -42,10 +43,11 @@ module.exports.dogGeneric_toOne_personSql = { }, "associations" : { "owner" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType" : "sql", "label": "firstName", "sublabel": "lastName" @@ -66,10 +68,11 @@ module.exports.personSql_toOne_hometownGeneric = { }, "associations":{ "unique_homeTown":{ - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Hometown", "targetKey" : "hometownId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType" : "generic", "label": "name" } @@ -88,10 +91,11 @@ module.exports.hometownGeneric_toMany_personSql = { }, "associations" : { "people" : { - "type" : "to_many", + "type" : "one_to_many", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "hometownId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType" : "sql", "label": "firstName", "sublabel": "lastName" @@ -111,7 +115,8 @@ module.exports.dogGeneric_genericToOne_person = { }, "associations" : { "owner" : { - "type" : "generic_to_one", + "type" : "many_to_one", + "implementation": "generic", "target" : "Person" } } @@ -130,7 +135,8 @@ module.exports.personSql_genericToMany_dog = { }, "associations":{ "dogs": { - "type": "generic_to_many", + "type": "one_to_many", + "implementation": "generic", "target": "Dog" } }, @@ -149,7 +155,8 @@ module.exports.dogDdm_genericToOne_person = { }, "associations" : { "owner" : { - "type" : "generic_to_one", + "type" : "many_to_one", + "implementation": "generic", "target" : "Person" } } @@ -169,7 +176,8 @@ module.exports.personDdm_genericToMany_dog = { }, "associations":{ "dogs": { - "type": "generic_to_many", + "type": "one_to_many", + "implementation": "generic", "target": "Dog" } }, diff --git a/test/unit_test_misc/data_models_generic_webservice.js b/test/unit_test_misc/data_models_generic_webservice.js index fc1aa541..3b3bad7e 100644 --- a/test/unit_test_misc/data_models_generic_webservice.js +++ b/test/unit_test_misc/data_models_generic_webservice.js @@ -10,17 +10,20 @@ module.exports.book = }, "associations": { "publisher" : { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "publi_sher", "targetKey": "publisher_id", - "keyIn": "book", + "keysIn": "book", "targetStorageType": "generic" }, "authors": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Person", "targetKey": "person_id", + "keysIn": "Person", "sourceKey": "book_id", "targetStorageType": "generic" } @@ -40,18 +43,21 @@ module.exports.person = "associations" : { "works" : { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "book", "targetKey": "book_id", "sourceKey": "person_id", + "keysIn": "book", "targetStorageType": "generic" }, "company":{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "publi_sher", "targetKey": "companyId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType": "generic" } } @@ -69,18 +75,20 @@ module.exports.publisher = "associations": { "publications" : { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "book", "targetKey": "publisher_id", - "keyIn": "book", + "keysIn": "book", "targetStorageType": "generic" }, "director":{ - "type":"to_one", + "type":"many_to_one", + "implementation": "foreignkeys", "target": "Person", "targetKey": "companyId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType": "generic" } } diff --git a/test/unit_test_misc/data_models_mongodb.js b/test/unit_test_misc/data_models_mongodb.js index b92c2fc1..dcf44d0c 100644 --- a/test/unit_test_misc/data_models_mongodb.js +++ b/test/unit_test_misc/data_models_mongodb.js @@ -15,20 +15,21 @@ module.exports.animal = { }, associations: { farm: { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "farm", targetKey: "farm_id", - keyIn: "animal", + keysIn: "animal", targetStorageType: "mongodb", label: "farm_name", }, food: { - type: "to_many", - reverseAssociationType: "to_many", + type: "many_to_many", + implementation: "foreignkeys", target: "food", targetKey: "animal_ids", sourceKey: "food_ids", - keyIn: "animal", + keysIn: "animal", targetStorageType: "mongodb", }, }, @@ -58,10 +59,11 @@ module.exports.dist_animal_instance1 = { associations: { dist_farm: { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "dist_farm", targetKey: "farm_id", - keyIn: "dist_animal", + keysIn: "dist_animal", targetStorageType: "distributed-data-model", }, }, diff --git a/test/unit_test_misc/data_models_neo4j.js b/test/unit_test_misc/data_models_neo4j.js index 49cc6546..1101bc5a 100644 --- a/test/unit_test_misc/data_models_neo4j.js +++ b/test/unit_test_misc/data_models_neo4j.js @@ -14,27 +14,29 @@ module.exports.movie = { }, associations: { director: { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "director", targetKey: "director_id", - keyIn: "movie", + keysIn: "movie", targetStorageType: "neo4j", label: "director_name", }, actor: { - type: "to_many", - reverseAssociationType: "to_many", + type: "many_to_many", + implementation: "foreignkeys", target: "actor", targetKey: "movie_ids", sourceKey: "actor_ids", - keyIn: "movie", + keysIn: "movie", targetStorageType: "neo4j", }, unique_review: { - type: "to_one", + type: "one_to_one", + implementation: "foreignkeys", target: "review", targetKey: "movie_id", - keyIn: "tracker", + keysIn: "tracker", targetStorageType: "neo4j", }, }, @@ -58,10 +60,11 @@ module.exports.dist_movie_instance1 = { }, associations: { dist_director: { - type: "to_one", + type: "many_to_one", + implementation: "foreignkeys", target: "dist_director", targetKey: "director_id", - keyIn: "dist_movie", + keysIn: "dist_movie", targetStorageType: "distributed-data-model", }, }, diff --git a/test/unit_test_misc/data_models_refactoring.js b/test/unit_test_misc/data_models_refactoring.js index 6220e3de..f0724f1e 100644 --- a/test/unit_test_misc/data_models_refactoring.js +++ b/test/unit_test_misc/data_models_refactoring.js @@ -12,29 +12,32 @@ module.exports.accession = { "associations": { "individuals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Individual", "targetKey": "accessionId", - "keyIn" : "Individual", + "keysIn" : "Individual", "targetStorageType": "sql", "label": "name" }, "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn" : "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn" : "Measurement", "targetStorageType": "sql", "label": "name" } @@ -59,29 +62,32 @@ module.exports.accession_ddm = { "associations": { "individuals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Individual", "targetKey": "accessionId", - "keyIn" : "Individual", + "keysIn" : "Individual", "targetStorageType": "distributed-data-model", "label": "name" }, "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn" : "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accessionId", - "keyIn" : "Measurement", + "keysIn" : "Measurement", "targetStorageType": "sql", "label": "name" } @@ -107,29 +113,32 @@ module.exports.accession_sql_adapter = { "associations": { "individuals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Individual", "targetKey": "accessionId", - "keyIn" : "Individual", + "keysIn" : "Individual", "targetStorageType": "sql", "label": "name" }, "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn" : "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accession_id", - "keyIn" : "Measurement", + "keysIn" : "Measurement", "targetStorageType": "sql", "label": "name" } @@ -155,30 +164,33 @@ module.exports.accession_zendro_adapter = { "associations": { "individuals": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Individual", "targetKey": "accessionId", - "keyIn" : "Individual", + "keysIn" : "Individual", "targetStorageType": "sql", "label": "name" }, "location": { - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Location", "targetKey": "locationId", - "keyIn" : "Accession", + "keysIn" : "Accession", "targetStorageType": "sql", "label": "country", "sublabel": "state" }, "measurements": { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Measurement", "targetKey": "accession_id", - "keyIn" : "Measurement", + "keysIn" : "Measurement", "targetStorageType": "sql", "label": "name" } diff --git a/test/unit_test_misc/data_models_zendro.js b/test/unit_test_misc/data_models_zendro.js index 67acd1b4..02598f44 100644 --- a/test/unit_test_misc/data_models_zendro.js +++ b/test/unit_test_misc/data_models_zendro.js @@ -10,7 +10,8 @@ module.exports.book = { "associations":{ "Authors" : { - "type" : "to_many", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Person", "targetKey" : "personId", "sourceKey" : "bookId", @@ -20,10 +21,11 @@ module.exports.book = { "sublabel" : "email" }, "publisher" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "publi_sher", "targetKey" : "publisher_id", - "keyIn" : "Book", + "keysIn" : "Book", "targetStorageType" : "generic", "label" : "name" } @@ -42,7 +44,8 @@ module.exports.person = { }, "associations":{ "works":{ - "type" : "to_many", + "type" : "many_to_many", + "implementation": "sql_cross_table", "target" : "Book", "targetKey" : "bookId", "sourceKey" : "personId", @@ -52,10 +55,11 @@ module.exports.person = { }, "company":{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "publi_sher", "targetKey": "companyId", - "keyIn": "Person", + "keysIn": "Person", "targetStorageType": "generic" } } @@ -74,18 +78,20 @@ module.exports.dog_one_assoc = { "associations" : { "owner" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "personId", - "keyIn" : "Dog", + "keysIn" : "Dog", "targetStorageType" : "sql" }, "veterinarian" : { - "type" : "to_one", + "type" : "many_to_one", + "implementation": "foreignkeys", "target" : "Person", "targetKey" : "veterinarianId", - "keyIn" : "Dog", + "keysIn" : "Dog", "targetStorageType" : "sql" } } @@ -104,18 +110,20 @@ module.exports.person_one_assoc = { "associations" : { "unique_pet" :{ - "type": "to_one", + "type": "many_to_one", + "implementation": "foreignkeys", "target": "Dog", "targetKey": "personId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "sql" }, "patients" : { - "type": "to_many", + "type": "one_to_many", + "implementation": "foreignkeys", "target": "Dog", "targetKey": "veterinarianId", - "keyIn": "Dog", + "keysIn": "Dog", "targetStorageType": "sql" } } diff --git a/test/unit_test_misc/test-describe/distributed-models.js b/test/unit_test_misc/test-describe/distributed-models.js index fc1309dc..bb1b45cf 100644 --- a/test/unit_test_misc/test-describe/distributed-models.js +++ b/test/unit_test_misc/test-describe/distributed-models.js @@ -330,7 +330,8 @@ const definition = { }, associations: { works: { - type: 'to_many', + type: 'many_to_many', + implementation: 'sql_cross_table', target: 'Book', targetKey: 'bookId', sourceKey: 'personId', @@ -338,24 +339,27 @@ const definition = { targetStorageType: 'sql' }, company: { - type: 'to_one', + type: 'many_to_one', + implementation: 'foreignkeys', target: 'publi_sher', targetKey: 'companyId', - keyIn: 'Person', + keysIn: 'Person', targetStorageType: 'zendro-server' }, dogs: { - type: 'to_many', + type: 'one_to_many', + implementation: 'foreignkeys', target: 'Dog', targetKey: 'personId', - keyIn: 'Dog', + keysIn: 'Dog', targetStorageType: 'sql' }, parrot: { - type: 'to_one', + type: 'many_to_one', + implementation: 'foreignkeys', target: 'Parrot', targetKey: 'personId', - keyIn: 'Parrot', + keysIn: 'Parrot', targetStorageType: 'sql' } }, @@ -380,10 +384,11 @@ const definition = { }, associations: { owner: { - type: 'to_one', + type: 'many_to_one', + implementation: 'foreignkeys', target: 'Person', targetKey: 'personId', - keyIn: 'Dog', + keysIn: 'Dog', targetStorageType: 'sql' } }, diff --git a/test/unit_test_misc/test-describe/zendro-servers.js b/test/unit_test_misc/test-describe/zendro-servers.js index 5760cece..54264fbc 100644 --- a/test/unit_test_misc/test-describe/zendro-servers.js +++ b/test/unit_test_misc/test-describe/zendro-servers.js @@ -259,7 +259,8 @@ const definition = { }, associations: { works: { - type: 'to_many', + type: 'many_to_many', + implementation: 'sql_cross_table', target: 'Book', targetKey: 'bookId', sourceKey: 'personId', @@ -268,10 +269,11 @@ const definition = { label: 'title' }, company: { - type: 'to_one', + type: 'many_to_one', + implementation: 'foreignkeys', target: 'publi_sher', targetKey: 'companyId', - keyIn: 'Person', + keysIn: 'Person', targetStorageType: 'generic' } }, diff --git a/views/create-models.ejs b/views/create-models.ejs index d436f2c0..e6ef0c11 100644 --- a/views/create-models.ejs +++ b/views/create-models.ejs @@ -113,16 +113,16 @@ module.exports = class <%- nameLc -%> extends Sequelize.Model{ <%for(let i=0; i< associationsArguments[key].length; i++){-%> <%if (key !== 'associations'){-%> <%if(associationsArguments[key][i].targetStorageType === 'sql' && !associationsArguments[key][i].assocThroughArray){-%> - <%if (associationsArguments[key][i].type === 'to_one' && associationsArguments[key][i].keyIn !== associationsArguments[key][i].target){-%> + <%if (associationsArguments[key][i].type.includes('to_one') && associationsArguments[key][i].keysIn !== associationsArguments[key][i].target){-%> <%- nameLc -%>.belongsTo(models.<%= associationsArguments[key][i].target_lc -%> <%}-%> - <% if (associationsArguments[key][i].type === 'to_one' && associationsArguments[key][i].keyIn === associationsArguments[key][i].target){-%> + <% if (associationsArguments[key][i].type.includes('to_one') && associationsArguments[key][i].keysIn === associationsArguments[key][i].target){-%> <%- nameLc -%>.hasOne(models.<%= associationsArguments[key][i].target_lc -%> <%}-%> - <% if (associationsArguments[key][i].type === 'to_many' && associationsArguments[key][i].keyIn === associationsArguments[key][i].target){-%> + <% if (associationsArguments[key][i].type === 'one_to_many' && associationsArguments[key][i].keysIn === associationsArguments[key][i].target){-%> <%- nameLc -%>.hasMany(models.<%= associationsArguments[key][i].target_lc -%> <%}-%> - <% if (associationsArguments[key][i].type === 'to_many_through_sql_cross_table' ){-%> + <% if (associationsArguments[key][i].type === 'many_to_many' && associationsArguments[key][i].implementation === 'sql_cross_table'){-%> <%- nameLc -%>.belongsToMany(models.<%= associationsArguments[key][i].target_lc -%> <%}-%> <% if(key === 'to_many_through_sql_cross_table'){ -%> ,{as: '<%= associationsArguments[key][i].name -%>',