Кемеровские программисты php общаются здесь
-
Anonymous
Ограничение внешнего ключа сформировано неправильно | Проект Ларавел
Сообщение
Anonymous »
Таблица аукционов
Код: Выделить всё
class CreateAuctionsTable extends Migration
{
public function up(): void
{
Schema::create('auctions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('car_id');
$table->unsignedBigInteger('current_bid_id');
$table->boolean('queue')->default(true);
$table->unsignedBigInteger('current_price')->default(0);
$table->foreign('car_id')->references('id')->on('cars')->onDelete('cascade');
$table->foreign('current_bid_id')->references('id')->on('bids')->onDelete('cascade');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('auctions');
}
}
Таблица ставок
Код: Выделить всё
Подробнее здесь: [url]https://stackoverflow.com/questions/78531006/foreign-key-constraint-is-incorrectly-formed-laravel-project[/url]
1716593082
Anonymous
Таблица аукционов
[code]class CreateAuctionsTable extends Migration
{
public function up(): void
{
Schema::create('auctions', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('car_id');
$table->unsignedBigInteger('current_bid_id');
$table->boolean('queue')->default(true);
$table->unsignedBigInteger('current_price')->default(0);
$table->foreign('car_id')->references('id')->on('cars')->onDelete('cascade');
$table->foreign('current_bid_id')->references('id')->on('bids')->onDelete('cascade');
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('auctions');
}
}
[/code]
Таблица ставок
[code]
Подробнее здесь: [url]https://stackoverflow.com/questions/78531006/foreign-key-constraint-is-incorrectly-formed-laravel-project[/url]