mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-21 08:50:57 -04:00
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
<?php
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
class $CLASS$ extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function up()
|
|
{
|
|
Schema::create(strtolower('$TABLE$'), function (Blueprint $table) {
|
|
$table->increments('id');
|
|
$table->unsignedInteger('user_id')->index();
|
|
$table->unsignedInteger('account_id')->index();
|
|
$table->unsignedInteger('client_id')->index()->nullable();
|
|
|
|
$FIELDS$
|
|
$table->timestamps();
|
|
$table->softDeletes();
|
|
$table->boolean('is_deleted')->default(false);
|
|
|
|
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
|
|
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
|
|
$table->foreign('client_id')->references('id')->on('clients')->onDelete('cascade');
|
|
|
|
$table->unsignedInteger('public_id')->index();
|
|
$table->unique( ['account_id', 'public_id'] );
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists(strtolower('$TABLE$'));
|
|
}
|
|
}
|