balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

latest waterline throws migrate: alter SQL error #6187

Closed ArdentZeal closed 5 years ago

ArdentZeal commented 10 years ago
Waterline encountered a fatal error when trying to perform the `alter` auto-migration strategy.
In a couple of seconds, the data (cached in memory) will be logged to stdout.
(a failsafe put in place to preserve development data)

In the mean time, here's the error:

{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1]
  stack: 'Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near \')\' at line 1\n    at Query.Sequence._packetToError (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Sequence.js:30:14)\n    at Query.ErrorPacket (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:82:18)\n    at Protocol._parsePacket (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:197:24)\n    at Parser.write (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Parser.js:62:12)\n    at Protocol.write (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:37:16)\n    at Socket.ondata (_stream_readable.js:534:20)\n    at Socket.EventEmitter.emit (events.js:126:20)\n    at readableAddChunk (_stream_readable.js:156:16)\n    at Socket.Readable.push (_stream_readable.js:123:10)\n    at TCP.onread (net.js:511:20)\n    --------------------\n    at Protocol._enqueue (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:110:26)\n    at PoolConnection.Connection.query (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/Connection.js:148:25)\n    at /Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/lib/adapter.js:366:22\n    at Object.async.eachSeries (/Users/matthias/Documents/WSProjects/Strucd/node_modules/async/lib/async.js:130:20)\n    at __CREATE_EACH__ (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/lib/adapter.js:337:15)\n    at afterwards (/Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/lib/connections/spawn.js:86:5)\n    at /Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/lib/connections/spawn.js:40:7\n    at /Users/matthias/Documents/WSProjects/Strucd/node_modules/sails-mysql/node_modules/mysql/lib/Pool.js:35:7\n    at process._tickDomainCallback (node.js:693:11)',
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlState: '42000',
  index: 0 }

================================
Data backup:
================================

[]
error: !!!! FATAL ERROR !!!!
Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1

In the latest waterline, it throws an error when performing auto migration. It works fine on an empty database, but as soon as there is some data in it, it might throw. I migrated from 0.10.2 to 4, so it might happen in 3 too.

mikermcneil commented 10 years ago

@ArdentZeal thanks for posting! Would you mind doing a SQL dump of your tables as they exist before lifting and posting them here? Also, what's your data model look like in WL? Are you using indexes?

ArdentZeal commented 10 years ago

I have like 15 models and 20 tables with all the junction tables. The models are pretty standard, using autoPK, no custom indexes of any sort at the moment. Only one model has lifecycle callbacks. I am also on express and waterline, not on sails.

Kind Regards

particlebanana commented 10 years ago

Should be fixed in #323