mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
update migration companies,address,contact,segments,segment_constants,segment_companies.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Classes\ValueObjects\Constants\CompanyType;
|
||||
use App\Classes\ValueObjects\Constants\BusinessType;
|
||||
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
@@ -19,9 +18,8 @@ class CreateCompaniesTable extends Migration
|
||||
Schema::create('companies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('reference');
|
||||
$table->integer('type')->default(CompanyType::COMPANY_BUSINESS);
|
||||
$table->integer('business_type')->default(BusinessType::IMPORTER);
|
||||
$table->string('reference','45');
|
||||
$table->integer('type')->default(BusinessType::IMPORTER);
|
||||
$table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
@@ -15,21 +15,20 @@ class CreateAddressesTable extends Migration
|
||||
{
|
||||
Schema::create('addresses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->unsigned();
|
||||
$table->foreignId('country_id')->unsigned();
|
||||
$table->foreignId('state_id')->unsigned();
|
||||
$table->foreignId('district_id')->unsigned();
|
||||
$table->string('postcode');
|
||||
$table->string('street_one');
|
||||
$table->string('street_two')->nullable();
|
||||
$table->integer('billing')->default(true);
|
||||
$table->morphs('owner');
|
||||
$table->string('street_one', '45');
|
||||
$table->string('street_two', '45')->nullable();
|
||||
$table->foreignId('district_id')->constrained();
|
||||
$table->foreignId('state_id')->constrained();
|
||||
$table->foreignId('country_id')->constrained();
|
||||
$table->string('postcode', '45');
|
||||
$table->integer('default');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$table->foreign('country_id')->references('id')->on('countries');
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
$table->foreign('state_id')->references('id')->on('states');
|
||||
$table->foreign('district_id')->references('id')->on('districts');
|
||||
Schema::table('addresses', function (Blueprint $table) {
|
||||
$table->string('owner_type', 191)->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,17 +15,18 @@ class CreateContactsTable extends Migration
|
||||
{
|
||||
Schema::create('contacts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->unsigned();
|
||||
$table->foreignId('country_id')->unsigned();
|
||||
$table->morphs('owner');
|
||||
$table->string('reference');
|
||||
$table->string('phone')->nullable();
|
||||
$table->string('phone', '45')->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('wechat_id')->nullable();
|
||||
$table->string('wechat_id', '45')->nullable();
|
||||
$table->integer('default');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$table->foreign('country_id')->references('id')->on('countries');
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('owner_type', 191)->change();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -17,11 +17,8 @@ class CreateSegmentsTable extends Migration
|
||||
{
|
||||
Schema::create('segments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->integer('type')->default(SegmentConstants::STANDARD_SEGMENT);
|
||||
$table->integer('status')->default(ApprovalStatus::APPROVED);
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
$table->foreignId('company_module_id')->constrained();
|
||||
$table->string('name', '45');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -15,14 +15,9 @@ class CreateSegmentConstantsTable extends Migration
|
||||
{
|
||||
Schema::create('segment_constants', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('segment_id')->unsigned();
|
||||
$table->string('name');
|
||||
$table->string('reference');
|
||||
$table->json('detail');
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('segment_id')->references('id')->on('segments');
|
||||
$table->foreignId('segment_id')->constrained();
|
||||
$table->string('reference','45');
|
||||
$table->json('value');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,10 @@ class CreateSegmentCompaniesTable extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('segment_companies', function (Blueprint $table) {
|
||||
$table->foreignId('segment_id')->unsigned();
|
||||
$table->foreignId('company_id')->unsigned();
|
||||
$table->softDeletes();
|
||||
$table->foreignId('segment_id')->constrained();
|
||||
$table->foreignId('company_id')->constrained();
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary(['segment_id', 'company_id']);
|
||||
$table->foreign('segment_id')->references('id')->on('segments');
|
||||
$table->foreign('company_id')->references('id')->on('companies');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,12 +28,6 @@ class CreateSegmentCompaniesTable extends Migration
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('segment_companies', function (Blueprint $table) {
|
||||
|
||||
$table->dropForeign('segment_companies_segment_id_foreign');
|
||||
$table->dropForeign('segment_companies_company_id_foreign');
|
||||
});
|
||||
|
||||
Schema::dropIfExists('segment_companies');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user