wintercms / wn-builder-plugin

GUI for building plugins in Winter CMS
MIT License
34 stars 12 forks source link

Error message when trying to create new version with migration #15

Closed ericp-mrel closed 2 years ago

ericp-mrel commented 2 years ago

This is the following message I receive when trying to save a version which contains a migration file.

Migration code should define a migration or seeder class. Leave the code field blank if you only want to update the version number.

Here is my migration file:

<?php namespace Radmin\Test\Updates;

use Schema;
use Winter\Storm\Database\Updates\Migration;

class BuilderTableCreateRadminTestSamples extends Migration
{
    public function up()
    {
        Schema::create('radmin_test_samples', function($table)
        {
            $table->engine = 'InnoDB';
            $table->increments('id')->unsigned();
            $table->string('name')->nullable();
            $table->timestamp('created_at')->nullable();
            $table->timestamp('updated_at')->nullable();
            $table->timestamp('deleted_at')->nullable();
        });
    }

    public function down()
    {
        Schema::dropIfExists('radmin_test_samples');
    }
}

This migration was generated from the database screen

No matter what contents I enter, it is always considered empty and does not allow me to save.

ericp-mrel commented 2 years ago

Diving into the source code, it looks like this plugin is using a tokenizer to validate the PHP file.

I am using PHP 8.0 for reference and it looks like this might be the reason I am getting this error. https://wiki.php.net/rfc/namespaced_names_as_token