Code: Select all
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]

Es gibt mir einen Fehler
SQLSTATE[HY000]: Allgemeiner Fehler: 1005 Tabelle wc_curtis kann nicht erstellt werden.
Code: Select all
ledger_accounts
table ledger_accounts add context ledger_accounts_party_id_foreign Fremdschlüssel (
Code: Select all
party_id
Code: Select all
id