Closed Spot-up closed 3 years ago
I haven't tested with a mysql database, I usually use sqlite. I will have to recreate the environment and apply a fix.
If you want to get this working for you asap you can publish the migrations (see readme) and set the key manually.
c_ci_ct_i
I think that that should work.
$table->index(["commentable_type", "commentable_id"]);
and comment on this too?
Change it to:
$table->index(["commentable_type", "commentable_id"], "ct_ci");
I think that should do it.
See laravel documentation for database migrations and setting the index name manually.
I added
Schema::create('comments', function (Blueprint $table) {
$table->bigIncrements('id');
...
$table->timestamps();
$table->engine = 'InnoDB';
});
The migration was successful
Shouldn't the engine by default be InnoDB?
Did you change the index name?
Send me the complete file that you have changed.
All my tables have MyISAM. I have not changed the Indices
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('commenter_id')->nullable();
$table->string('commenter_type')->nullable();
$table->index(["commenter_id", "commenter_type"]);
$table->string('guest_name')->nullable();
$table->string('guest_email')->nullable();
$table->string("commentable_type");
$table->string("commentable_id");
$table->index(["commentable_type", "commentable_id"]);
$table->text('comment');
$table->boolean('approved')->default(true);
$table->unsignedBigInteger('child_id')->nullable();
$table->foreign('child_id')->references('id')->on('comments')->onDelete('cascade');
$table->softDeletes();
$table->timestamps();
$table->engine = 'InnoDB';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comments');
}
}
For some reason the migration date 2018_06_30_113500_create_comments_table.php
How to allow guests to reply to a comment
How to allow guests to reply to a comment
Currently, guests can only submit new comments, not reply to existing. You could probably create your own logic for that functionality. Discussion on this topic should go to a new issue if needed.
OK, thanks
PHP 7.4.9, MySQL 5.7.31, Laravel 8.7.1, DB collate utf8_general_ci
databse.php
AppServiceProvider.php