Код: Выделить всё
Schema::table('ledger_accounts', function (Blueprint $table) {
$table->enum("type", ["simple", "bank", "party", "employee"])->after("id")->default("simple");
$table->unsignedBigInteger("party_id")->nullable()->default(null)->after("account_type");
$table->unsignedBigInteger("employee_id")->nullable()->default(null)->after("party_id");
$table->string("bank_name", 120)->nullable()->after("employee_id");
$table->string("bank_branch_name", 120)->nullable()->after("bank_name");
$table->string("bank_branch_address", 120)->nullable()->after("bank_branch_name");
$table->string("bank_branch_ifsc", 30)->nullable()->after("bank_branch_address");
$table->string("bank_account_no", 30)->nullable()->after("bank_branch_ifsc");
$table->string("comments", 255)->nullable()->after("bank_account_no");
$table->boolean("is_active")->default(1)->after("comments");
$table->bigInteger("created_by")->nullable();
$table->bigInteger("updated_by")->nullable();
});
Schema::table('ledger_accounts', function (Blueprint $table) {
$table->foreign('party_id')->references('id')->on('parties')->onDelete('restrict');
$table->foreign('employee_id')->references('id')->on('employees')->onDelete('restrict');
});
[img]https://i. sstatic.net/KpM1jkGy.png[/img]

Выдает ошибку
SQLSTATE[HY000]: Общая ошибка: 1005 Невозможно создать таблицу wc_curtis.
Код: Выделить всё
ledger_accounts
tableledger_accounts добавить ограничениеledger_accounts_party_id_foreign внешний ключ (
Код: Выделить всё
party_id
Код: Выделить всё
id
Подробнее здесь: https://stackoverflow.com/questions/793 ... tly-formed