Error Unknown column in field list - when mysql table exist

1,266 views
Skip to first unread message

LIFE FILM

unread,
May 12, 2015, 4:44:33 PM5/12/15
to loopb...@googlegroups.com
Hi
I am add my table from the database mysql
with existed users and structure
I inherit User model
but loopback an error

{
  "name": "ModxUser",
  "base": "User",
  "idInjection": false,
  "options": {
    "validateUpsert": true
  },
  "mysql": {
    "schema": "dblifefilm",
    "table": "modx_users"
  },
  "properties": {
    "remoteData": {
      "type": "string",
      "required": false,
      "length": 65535,
      "precision": null,
      "scale": null,
      "mysql": {
        "columnName": "remote_data",
        "dataType": "text",
        "dataLength": 65535,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "Y"
      },
      "_selectable": true
    },
    "primaryGroup": {
      "type": "string",
      "required": false,
      "length": null,
      "precision": 10,
      "scale": 0,
      "mysql": {
        "columnName": "primary_group",
        "dataType": "int",
        "dataLength": null,
        "dataPrecision": 10,
        "dataScale": 0,
        "nullable": "N"
      },
      "_selectable": false
    },
    "active": {
      "type": "string",
      "required": false,
      "length": null,
      "precision": 3,
      "scale": 0,
      "mysql": {
        "columnName": "active",
        "dataType": "tinyint",
        "dataLength": null,
        "dataPrecision": 3,
        "dataScale": 0,
        "nullable": "N"
      },
      "_selectable": false
    },
    "id": {
      "type": "number",
      "id": true,
      "required": true,
      "length": null,
      "precision": 10,
      "scale": 0,
      "mysql": {
        "columnName": "id",
        "dataType": "int",
        "dataLength": null,
        "dataPrecision": 10,
        "dataScale": 0,
        "nullable": "N"
      },
      "_selectable": false
    },
    "remoteKey": {
      "type": "string",
      "required": false,
      "length": 255,
      "precision": null,
      "scale": null,
      "mysql": {
        "columnName": "remote_key",
        "dataType": "varchar",
        "dataLength": 255,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "Y"
      },
      "_selectable": true
    },
    "salt": {
      "type": "string",
      "required": false,
      "length": 100,
      "precision": null,
      "scale": null,
      "mysql": {
        "columnName": "salt",
        "dataType": "varchar",
        "dataLength": 100,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "N"
      },
      "_selectable": false
    },
    "sessionStale": {
      "type": "string",
      "required": false,
      "length": 65535,
      "precision": null,
      "scale": null,
      "mysql": {
        "columnName": "session_stale",
        "dataType": "text",
        "dataLength": 65535,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "Y"
      },
      "_selectable": true
    },
    "sudo": {
      "type": "string",
      "required": false,
      "length": null,
      "precision": 3,
      "scale": 0,
      "mysql": {
        "columnName": "sudo",
        "dataType": "tinyint",
        "dataLength": null,
        "dataPrecision": 3,
        "dataScale": 0,
        "nullable": "N"
      },
      "_selectable": false
    },
    "username": {
      "type": "string",
      "required": false,
      "length": 100,
      "precision": null,
      "scale": null,
      "mysql": {
        "columnName": "username",
        "dataType": "varchar",
        "dataLength": 100,
        "dataPrecision": null,
        "dataScale": null,
        "nullable": "N"
      },
      "_selectable": false
    }
  },
  "validations": [],
  "relations": {},
  "acls": [
    {
      "accessType": "READ",
      "principalType": "ROLE",
      "principalId": "$everyone",
      "permission": "ALLOW"
    },
    {
      "accessType": "EXECUTE",
      "principalType": "ROLE",
      "principalId": "$owner",
      "permission": "ALLOW",
      "property": "unlink"
    },
    {
      "principalType": "ROLE",
      "principalId": "$owner",
      "permission": "ALLOW",
      "property": "upsert"
    }
  ],
  "methods": []
}




{
 
"error": {
   
"name": "Error",
   
"status": 500,
   
"message": "ER_BAD_FIELD_ERROR: Unknown column 'remote_data' in 'field list'",
   
"code": "ER_BAD_FIELD_ERROR",
   
"errno": 1054,
   
"sqlState": "42S22",
   
"index": 0,
   
"stack": "Error: ER_BAD_FIELD_ERROR: Unknown column 'remote_data' in 'field list'\n    at Query.Sequence._packetToError (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:48:14)\n    at Query.ErrorPacket (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:83:18)\n    at Protocol._parsePacket (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/Protocol.js:271:23)\n    at Parser.write (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/Parser.js:77:12)\n    at Protocol.write (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/Protocol.js:39:16)\n    at Socket.<anonymous> (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/Connection.js:92:28)\n    at Socket.emit (events.js:95:17)\n    at Socket.<anonymous> (_stream_readable.js:765:14)\n    at Socket.emit (events.js:92:17)\n    at emitReadable_ (_stream_readable.js:427:10)\n    --------------------\n    at Protocol._enqueue (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/Protocol.js:135:48)\n    at PoolConnection.Connection.query (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/Connection.js:197:25)\n    at Object.eval [as forward] (eval at recompile (/usr/lib/node_modules/strongloop/node_modules/strong-agent/lib/proxy.js:237:15), <anonymous>:4:32)\n    at PoolConnection.eval [as query] (eval at wrap (/usr/lib/node_modules/strongloop/node_modules/strong-agent/lib/proxy.js:193:20), <anonymous>:3:21)\n    at runQuery (/home/debian/universal/node_modules/loopback-connector-mysql/lib/mysql.js:153:16)\n    at /home/debian/universal/node_modules/loopback-connector-mysql/lib/mysql.js:199:7\n    at Handshake.onConnect (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/Pool.js:59:7)\n    at Handshake.<anonymous> (/home/debian/universal/node_modules/loopback/node_modules/continuation-local-storage/context.js:74:17)\n    at Handshake.b [as _callback] (domain.js:183:18)\n    at Handshake.Sequence.end (/home/debian/universal/node_modules/loopback-connector-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)"
 
}

}


Raymond Feng

unread,
May 12, 2015, 6:39:46 PM5/12/15
to loopb...@googlegroups.com
You will need to migrate/update the DB tables based on the model definitions. See:


You can use StrongLoop Arc if you need a GUI.

Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

LIFE FILM

unread,
May 12, 2015, 6:52:07 PM5/12/15
to loopb...@googlegroups.com
thanks
but i did it
with slc arc

 

Raymond Feng

unread,
May 12, 2015, 6:56:54 PM5/12/15
to loopb...@googlegroups.com
When did you see the error, during user login? Please make sure your sub model is the one serving /api/users. Check server/model-config.json to set public: false for base User and true for the sub user.

Thanks,

---
Raymond Feng
Co-Founder and Architect @ StrongLoop, Inc.

StrongLoop makes it easy to develop APIs in Node, plus get DevOps capabilities like monitoring, debugging and clustering.

On May 12, 2015, at 3:52 PM, LIFE FILM <in...@3dsweb.ru> wrote:

thanks
but i did it
with slc arc

 

LIFE FILM

unread,
May 12, 2015, 7:23:31 PM5/12/15
to loopb...@googlegroups.com

no... when use explorer

with quest - in acl accepted

i use this example https://github.com/cosmojs/universal

it,s ok (Please make sure your sub model is the one serving /api/users. Check server/model-config.json to set public: false for base User and true for the sub user.)

BaseUser -work

my ModxUser - dont work


Reply all
Reply to author
Forward
0 new messages