awssat / laravel-sync-migration

Developer tool helps to sync migrations without refreshing the database
MIT License
108 stars 13 forks source link

ColumnsType is not in use #12

Closed yuhal closed 2 years ago

yuhal commented 2 years ago

Hello~ awssat. I found a bug,columnsType function is not in use. The following changes have been tried and it works fine.

$type = Regex::match('/\$.*->(.*)\(/', $line)->group(1);

replace

$type = Regex::match('/\$.*?->(.*?)\(/', $line)->group(1);
BSN4 commented 2 years ago

can you share your schema please ?

yuhal commented 2 years ago
Schema::create('demos', function (Blueprint $table) {
    $table->increments('id');
    $table->char('input', 50)->nullable()->comment('文本域');
    $table->string('textarea', 500)->nullable()->comment('多行文本域');
    $table->string('file', 500)->nullable()->comment('文件上传');
    $table->string('single_select', 500)->nullable()->comment('单选框');
    $table->string('multiple_select', 500)->nullable()->comment('多选框');
    $table->char('other', 50)->nullable()->comment('其他');
    $table->text('editor')->nullable()->comment('编辑器');
    $table->dateTime('date')->nullable()->comment('日期选择器');
    $table->dateTime('time')->nullable()->comment('时间选择器');
    $table->char('password', 50)->nullable()->comment('密码框');
    $table->dateTime('datetime')->nullable()->comment('日期时间选择器');
    $table->dateTime('created_at')->nullable()->comment('创建时间');
    $table->dateTime('updated_at')->nullable()->comment('修改时间');
    $table->softDeletes()->comment('删除时间');
});
BSN4 commented 2 years ago

yup I think thats because you have ->comment regex not detect it , your solution probably works but not sure if it affects other use cases, sadly we don't have tests, can you test it manually without ->comment and open PR ?

BSN4 commented 2 years ago

merged it thanks for your contribution