框架: Laravel 5.2 数据库: MySQL PHP: 7.0
我有一个名为“pops”的表:
Schema::create('pops', function (Blueprint $table) {
$table->string('id')->primary()->index();
$table->string('ab_test_parent_id')->nullable();
$table->string('cloned_parent_id')->nullable();
$table->timestamps();
});
而表"conversions":
Schema::create('conversions', function (Blueprint $table) {
$table->string('id')->primary()->index();
$table->integer('users')->default(null);
$table->string('name',256)->default(null);
$table->string('pop_id');
$table->foreign('pop_id')->references('id')->on('pops')->onDelete('cascade')->onUpdate('cascade');
$table->timestamps();
});
我已在"conversions"表中设置了一个外键(pop_id)。那么这是否意味着外键(pop_id)也是索引?如果不是......我需要做什么才能将其变成索引?
谢谢!