42coders / workflows

The Workflow Package add Drag & Drop Workflows to your Laravel Application.
https://workflows.42coders.com
MIT License
253 stars 66 forks source link

Table Prefix only considered on up method #10

Closed freestyledork closed 3 years ago

freestyledork commented 3 years ago

Looks like a nice package. I was reviewing the code, I noticed you allow prefixing the table names. The migrations only use the prefix on the up() method. When calling down via a rollback, you could end up dropping a different table. Kind of a critical issue.

{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create(config('workflows.db_prefix').'workflows', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('workflows');
    }
}
Max-Hutschenreiter commented 3 years ago

Thanks! fixed it