TablePlus / tabledump

This is a TablePlus plugin which add `copy table creation` menu in left panel
MIT License
104 stars 18 forks source link

bug: default 'string' values are missing the quotes #26

Open Gompje opened 3 years ago

Gompje commented 3 years ago

generated:

$table->string('timezone', 100)->default(Europe/Brussels);

correct:

$table->string('timezone', 100)->default('Europe/Brussels');
niektenhoopen commented 3 years ago

This seems to be broken in #19 where the compatibility with string default values is removed. Maybe @Vmadmax is using a different database engine than you (/us)?

@Vmadmax I am on MySQL 8 and run into the same issue as @Gompje. Any idea why you removed the JSON.stringify part?

Vmadmax commented 3 years ago

@Gompje @niektenhoopen Yes I can confirm, it's an MySQL version 8 bug. It's working correct in 5.7. In my test, 5.7 will return 'de' and 8 only de

We need to check the selected MySQL version, but I have no idea where to get this information.

niektenhoopen commented 3 years ago

@Vmadmax Probably only @huyphams can tell us. The only thing I could find about context is: https://github.com/TablePlus/TablePlus/issues/1532

context.driver() tells us the driver but not the version...

We could run a query SELECT VERSION(); but that feels 'ugly'.