migrate file

This commit is contained in:
glovetleong
2021-06-22 09:48:33 +08:00
parent 8fa80e4a1a
commit abca7bbb60
18 changed files with 442 additions and 0 deletions
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEntitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entities', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('entities');
}
}
@@ -0,0 +1,35 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEntitySignaturesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entity_signatures', function (Blueprint $table) {
$table->id();
$table->bigInteger('entity_id')->unsigned()->nullable();
$table->foreign('entity_id')->references('id')->on('entities')->onDelete('cascade');
$table->integer('type')->nullable()->default(1);
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('entity_signatures');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateEntityLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('entity_logs', function (Blueprint $table) {
$table->id();
$table->bigInteger('entity_id')->unsigned()->nullable();
$table->foreign('entity_id')->references('id')->on('entities')->onDelete('cascade');
$table->json('history')->nullable();
$table->text('remark')->nullable();
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('entity_logs');
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contracts', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('status')->nullable()->default(1);
$table->timestamp('completed_at')->nullable();
$table->timestamp('failed_at')->nullable();
$table->timestamp('start_at')->nullable();
$table->timestamp('end_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contracts');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contract_logs', function (Blueprint $table) {
$table->id();
$table->bigInteger('contract_id')->unsigned()->nullable();
$table->foreign('contract_id')->references('id')->on('contracts')->onDelete('cascade');
$table->json('history')->nullable();
$table->text('remark')->nullable();
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contract_logs');
}
}
@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractEntitiesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contract_entities', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->bigInteger('contract_id')->unsigned()->nullable();
$table->foreign('contract_id')->references('id')->on('contracts')->onDelete('cascade');
$table->bigInteger('entity_id')->unsigned()->nullable();
$table->foreign('entity_id')->references('id')->on('entities')->onDelete('cascade');
$table->bigInteger('entity_signature_id')->unsigned()->nullable();
$table->foreign('entity_signature_id')->references('id')->on('entity_signatures')->onDelete('cascade');
$table->integer('type')->nullable()->default(1);
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contract_entities');
}
}
@@ -0,0 +1,49 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractObligationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contract_obligations', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->bigInteger('contract_id')->unsigned()->nullable();
$table->foreign('contract_id')->references('id')->on('contracts')->onDelete('cascade');
$table->bigInteger('contract_entity_id')->unsigned()->nullable();
$table->foreign('contract_entity_id')->references('id')->on('contract_entities')->onDelete('cascade');
$table->string('reference');
$table->json('content');
$table->integer('must_complete')->nullable()->default(1);
$table->integer('must_accept')->nullable()->default(1);
$table->integer('complete_status')->nullable()->default(1);
$table->integer('accept_status')->nullable()->default(1);
$table->integer('type')->nullable()->default(1);
$table->integer('status')->nullable()->default(1);
$table->timestamp('completed_at')->nullable();
$table->timestamp('failed_at')->nullable();
$table->timestamp('start_at')->nullable();
$table->timestamp('end_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contract_obligations');
}
}
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractObligationLogsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contract_obligation_logs', function (Blueprint $table) {
$table->id();
$table->bigInteger('contract_obligation_id')->unsigned()->nullable();
$table->foreign('contract_obligation_id')->references('id')->on('contract_obligations')->onDelete('cascade');
$table->json('history')->nullable();
$table->text('remark')->nullable();
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contract_obligation_logs');
}
}
@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateContractObligationDependenciesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('contract_obligation_dependencies', function (Blueprint $table) {
$table->id();
$table->bigInteger('user_id')->unsigned()->nullable();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->bigInteger('contract_obligation_id')->unsigned()->nullable();
$table->foreign('contract_obligation_id')->references('id')->on('contract_obligations')->onDelete('cascade');
$table->bigInteger('depend_contract_obligation_id')->unsigned()->nullable();
$table->foreign('depend_contract_obligation_id')->references('id')->on('contract_obligations')->onDelete('cascade');
$table->integer('status')->nullable()->default(1);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('contract_obligation_dependencies');
}
}