cviebrock / sequel-pro-laravel-export

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

Default value use double single quotes when it's a string #28

Closed pbrisson closed 4 years ago

pbrisson commented 4 years ago

Hi there,

First, thanks for this awesome tool!

I just exported about 90 tables from a database and noticed default value use double single quotes when it's a string (or a date) in the migration.

For example:

CREATE TABLE `ads` (
  `id` int(10) UNSIGNED NOT NULL,
  `local_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `remote_id` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `source` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT 'google'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

... generates this migration ...


<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * Migration auto-generated by Sequel Pro Laravel Export (1.5.0)
 * @see https://github.com/cviebrock/sequel-pro-laravel-export
 */
class CreateAdsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('ads', function (Blueprint $table) {
            $table->increments('id');
            $table->string('local_id', 255);
            $table->string('remote_id', 255);
            $table->string('source', 20)->default(''google'');

            $table->unique('remote_id', 'ads_remote_id_unique');
            $table->unique('local_id', 'ads_local_id_site_id_unique');

        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('ads');
    }
}

The value referring google is a syntax error above.

I'm using bundle version 1.5.0 with Sequel Pro 1.1.2 version 4541 (602e11a) on MariaDB 10.3.17-MariaDB-0+deb10u1 (Debian 10).

cviebrock commented 4 years ago

Sorry for the delay. Can you try the new 1.6.0 bundle version?

cviebrock commented 4 years ago

Closing due to no response. Feel free to re-open or comment if you are still having issues.