loopbackio / loopback-connector-oracle

Connect Loopback to Oracle
http://loopback.io/doc/en/lb3/Oracle-connector.html
Other
28 stars 30 forks source link

Custom relation field name #155

Closed pedropapa closed 6 years ago

pedropapa commented 6 years ago

I wonder if is it possible to use a custom field name for a loopback relation using the oracle connector.

Currently, when you declare a new relation and persist the model to the database, it would create a field with a name consisting in the name of the relation plus "ID", so the following relation:

"relations": {
    "area": {
      "type": "belongsTo",
      "model": "Areas",
      "foreignKey": ""
    }
  },

Would generate a field named "AREAID" on the table.

I need to change this field name, so I tried something like:

"relations": {
    "area": {
      "type": "belongsTo",
      "model": "Areas",
      "foreignKey": "",
      "oracle":{
        "columnName": "CO_AREA",
        "dataType": "NUMBER",
        "dataLength": 10
      }
    }
  },

but it had no effect.