cviebrock / sequel-pro-laravel-export

A Sequel Pro / Sequel Ace bundle to generate Laravel migration files from existing tables.
MIT License
921 stars 55 forks source link

Query error #20

Closed n8jadams closed 7 years ago

n8jadams commented 7 years ago

When I export this one specific table, it doesn't work and I get a little notification: "Query error."

Here is the sql table info:

CREATE TABLE `call` (
  `call_ID` bigint(20) NOT NULL AUTO_INCREMENT,
  `account_number` varchar(12) NOT NULL,
  `caller_phone` varchar(32) DEFAULT '',
  `caller_name` varchar(64) DEFAULT '',
  `caller_address` varchar(128) DEFAULT '',
  `caller_city` varchar(64) DEFAULT '',
  `call_type` varchar(64) DEFAULT '',
  `call_description` text NOT NULL,
  `agent` varchar(64) DEFAULT '',
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `is_resolved` tinyint(1) DEFAULT '0',
  `customer_type` tinyint(4) DEFAULT '0',
  `caller_account_number` varchar(32) DEFAULT '',
  PRIMARY KEY (`call_ID`),
  KEY `account_number` (`account_number`),
  KEY `timestamp` (`timestamp`)
) ENGINE=MyISAM AUTO_INCREMENT=1405309 DEFAULT CHARSET=latin1;

Every other table in the database I was trying to migrate worked flawlessly (huge thumbs up), just this one threw it off for some reason.

If it's necessary to know, I'm using Sequel Pro 1.1.2 on Mac El Capitan.

cviebrock commented 7 years ago

I wasn't escaping the table name correctly in the export script:

SHOW INDEXES FROM call;

I've changed that to the following, which now works;

SHOW INDEXES FROM `call`;

Version 1.2.0 should be tagged shortly. Thanks for the find!

n8jadams commented 7 years ago

Is it done? I saw that you pushed a change and I immediately tested it. Now all of my tables are giving the "Query error." Even this call one.

cviebrock commented 7 years ago

Yeah, I untagged the release ... something else broke, and I'm working on it now.

n8jadams commented 7 years ago

Thanks man. This is an awesome piece of software.

cviebrock commented 7 years ago

This took embarrassingly longer than I wanted, but could you try the most recent version before I tag it? I also took the opportunity to clean up the output a bit with more useful info and/or error messages.

If it works for you, I'll tag and bag it. ;)

n8jadams commented 7 years ago

Well, it exported them successfully. I tried migrating and got a parse error.

[Symfony\Component\Debug\Exception\FatalThrowableError]  
Parse error: syntax error, unexpected ',' 

Not a very descriptive error message. :/

I opened the first generated migration that was made and I found this couple of lines that looks wrong:

$table->foreign(, '
')->references('')->on('')->onDelete('')->onUpdate('');

Upon scanning through a few more, that seems to happen every time with the $table->foreign() method.

cviebrock commented 7 years ago

Awesome ... thanks! Versino 1.2.0 is now tagged (with a bit fancier output now too).