Я получаю следующую ошибку при запуске миграции. Ошибка в моей терминальной консоли:
SQLSTATE[42000]: Syntax error or access violation: 1170 BLOB/TEXT column 'referral_code' used in key specification without a key length (SQL: alter table `users` add index `users_referral_code_index`(`referral_code`))
Ниже приведен мой фактический файл миграции. Я не могу понять, почему это происходит, так как я использовал этот шаблон ранее с другими миграциями.
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddReferralInfoToUsersTable extends Migration
{
public function up()
{
Schema::table('shop_users', function (Blueprint $table) {
$table->text('referral_code')->nullable();
$table->integer('referral_uses')->nullable();
$table->integer('referral_revenue')->nullable();
$table->index(['referral_code']);
});
}
}