From abca7bbb6085eeb56af831f3464c1b208ee49c32 Mon Sep 17 00:00:00 2001 From: glovetleong Date: Tue, 22 Jun 2021 09:48:33 +0800 Subject: [PATCH] migrate file --- app/Models/Contract.php | 11 +++++ app/Models/ContractEntity.php | 11 +++++ app/Models/ContractLog.php | 11 +++++ app/Models/ContractObligation.php | 11 +++++ app/Models/ContractObligationDependency.php | 11 +++++ app/Models/ContractObligationLog.php | 11 +++++ app/Models/Entity.php | 11 +++++ app/Models/EntityLog.php | 11 +++++ app/Models/EntitySignature.php | 11 +++++ ...021_06_22_012552_create_entities_table.php | 34 +++++++++++++ ..._012610_create_entity_signatures_table.php | 35 +++++++++++++ ..._06_22_012626_create_entity_logs_table.php | 36 ++++++++++++++ ...21_06_22_012651_create_contracts_table.php | 38 ++++++++++++++ ...6_22_012652_create_contract_logs_table.php | 36 ++++++++++++++ ..._012704_create_contract_entities_table.php | 41 ++++++++++++++++ ...3528_create_contract_obligations_table.php | 49 +++++++++++++++++++ ..._create_contract_obligation_logs_table.php | 36 ++++++++++++++ ...contract_obligation_dependencies_table.php | 38 ++++++++++++++ 18 files changed, 442 insertions(+) create mode 100644 app/Models/Contract.php create mode 100644 app/Models/ContractEntity.php create mode 100644 app/Models/ContractLog.php create mode 100644 app/Models/ContractObligation.php create mode 100644 app/Models/ContractObligationDependency.php create mode 100644 app/Models/ContractObligationLog.php create mode 100644 app/Models/Entity.php create mode 100644 app/Models/EntityLog.php create mode 100644 app/Models/EntitySignature.php create mode 100644 database/migrations/2021_06_22_012552_create_entities_table.php create mode 100644 database/migrations/2021_06_22_012610_create_entity_signatures_table.php create mode 100644 database/migrations/2021_06_22_012626_create_entity_logs_table.php create mode 100644 database/migrations/2021_06_22_012651_create_contracts_table.php create mode 100644 database/migrations/2021_06_22_012652_create_contract_logs_table.php create mode 100644 database/migrations/2021_06_22_012704_create_contract_entities_table.php create mode 100644 database/migrations/2021_06_22_013528_create_contract_obligations_table.php create mode 100644 database/migrations/2021_06_22_013529_create_contract_obligation_logs_table.php create mode 100644 database/migrations/2021_06_22_013621_create_contract_obligation_dependencies_table.php diff --git a/app/Models/Contract.php b/app/Models/Contract.php new file mode 100644 index 0000000..d51e2fe --- /dev/null +++ b/app/Models/Contract.php @@ -0,0 +1,11 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_012610_create_entity_signatures_table.php b/database/migrations/2021_06_22_012610_create_entity_signatures_table.php new file mode 100644 index 0000000..b60d901 --- /dev/null +++ b/database/migrations/2021_06_22_012610_create_entity_signatures_table.php @@ -0,0 +1,35 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_012626_create_entity_logs_table.php b/database/migrations/2021_06_22_012626_create_entity_logs_table.php new file mode 100644 index 0000000..cb0c743 --- /dev/null +++ b/database/migrations/2021_06_22_012626_create_entity_logs_table.php @@ -0,0 +1,36 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_012651_create_contracts_table.php b/database/migrations/2021_06_22_012651_create_contracts_table.php new file mode 100644 index 0000000..ca5a1a3 --- /dev/null +++ b/database/migrations/2021_06_22_012651_create_contracts_table.php @@ -0,0 +1,38 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_012652_create_contract_logs_table.php b/database/migrations/2021_06_22_012652_create_contract_logs_table.php new file mode 100644 index 0000000..13890c9 --- /dev/null +++ b/database/migrations/2021_06_22_012652_create_contract_logs_table.php @@ -0,0 +1,36 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_012704_create_contract_entities_table.php b/database/migrations/2021_06_22_012704_create_contract_entities_table.php new file mode 100644 index 0000000..7f59fc4 --- /dev/null +++ b/database/migrations/2021_06_22_012704_create_contract_entities_table.php @@ -0,0 +1,41 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_013528_create_contract_obligations_table.php b/database/migrations/2021_06_22_013528_create_contract_obligations_table.php new file mode 100644 index 0000000..4860f7d --- /dev/null +++ b/database/migrations/2021_06_22_013528_create_contract_obligations_table.php @@ -0,0 +1,49 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_013529_create_contract_obligation_logs_table.php b/database/migrations/2021_06_22_013529_create_contract_obligation_logs_table.php new file mode 100644 index 0000000..2792b51 --- /dev/null +++ b/database/migrations/2021_06_22_013529_create_contract_obligation_logs_table.php @@ -0,0 +1,36 @@ +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'); + } +} diff --git a/database/migrations/2021_06_22_013621_create_contract_obligation_dependencies_table.php b/database/migrations/2021_06_22_013621_create_contract_obligation_dependencies_table.php new file mode 100644 index 0000000..b35cc37 --- /dev/null +++ b/database/migrations/2021_06_22_013621_create_contract_obligation_dependencies_table.php @@ -0,0 +1,38 @@ +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'); + } +}