diff --git a/database/migrations/2021_06_23_151607_modify_users_table.php b/database/migrations/2021_06_23_151607_modify_users_table.php new file mode 100644 index 00000000..6d4760e4 --- /dev/null +++ b/database/migrations/2021_06_23_151607_modify_users_table.php @@ -0,0 +1,47 @@ +dropColumn('email_verified_at'); + }); + } + + Schema::table('users', function (Blueprint $table) { + $table->integer('type')->default(RoleTypes::USER)->after('password'); + $table->integer('status')->default(ApprovalStatus::PENDING_VERIFICATION)->after('type'); + $table->timestamp('active_at')->nullable()->after('remember_token'); + $table->softDeletes()->after('active_at'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->timestamp('email_verified_at')->nullable(); + $table->dropColumn('type'); + $table->dropColumn('status'); + $table->dropColumn('active_at'); + $table->dropSoftDeletes(); + }); + } +} diff --git a/database/migrations/2021_06_23_151733_create_countries_table.php b/database/migrations/2021_06_23_151733_create_countries_table.php new file mode 100644 index 00000000..32046637 --- /dev/null +++ b/database/migrations/2021_06_23_151733_create_countries_table.php @@ -0,0 +1,31 @@ +id(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('countries'); + } +} diff --git a/database/migrations/2021_06_23_151757_create_companies_table.php b/database/migrations/2021_06_23_151757_create_companies_table.php new file mode 100644 index 00000000..9eac0cc4 --- /dev/null +++ b/database/migrations/2021_06_23_151757_create_companies_table.php @@ -0,0 +1,40 @@ +id(); + $table->string('name'); + $table->string('reference'); + $table->integer('type')->default(CompanyType::COMPANY_BUSINESS); + $table->integer('business_type')->default(BusinessType::IMPORTER); + $table->integer('status')->default(ApprovalStatus::PENDING_SUBMISSION); + $table->softDeletes(); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('companies'); + } +} diff --git a/database/migrations/2021_06_23_151826_create_contacts_table.php b/database/migrations/2021_06_23_151826_create_contacts_table.php new file mode 100644 index 00000000..c8e70331 --- /dev/null +++ b/database/migrations/2021_06_23_151826_create_contacts_table.php @@ -0,0 +1,41 @@ +id(); + $table->foreignId('company_id')->unsigned(); + $table->foreignId('country_id')->unsigned(); + $table->string('reference'); + $table->string('phone')->nullable(); + $table->string('email')->nullable(); + $table->string('wechat_id')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('country_id')->references('id')->on('countries'); + $table->foreign('company_id')->references('id')->on('companies'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('contacts'); + } +} diff --git a/database/migrations/2021_06_23_152020_create_user_email_verifications_table.php b/database/migrations/2021_06_23_152020_create_user_email_verifications_table.php new file mode 100644 index 00000000..2f4b78e4 --- /dev/null +++ b/database/migrations/2021_06_23_152020_create_user_email_verifications_table.php @@ -0,0 +1,38 @@ +id(); + $table->string('email', 100); + $table->string('token', 32); + $table->boolean('is_complete')->default(false); + $table->boolean('is_active'); + $table->boolean('is_sent')->default(false); + $table->timestamps(); + + $table->foreign('email')->references('email')->on('users'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('user_email_verifications'); + } +} diff --git a/database/migrations/2021_06_23_152429_create_employees_table.php b/database/migrations/2021_06_23_152429_create_employees_table.php new file mode 100644 index 00000000..f159e360 --- /dev/null +++ b/database/migrations/2021_06_23_152429_create_employees_table.php @@ -0,0 +1,37 @@ +foreignId('company_id')->unsigned(); + $table->foreignId('user_id')->unsigned(); + $table->integer('status')->default(ApprovalStatus::APPROVED); + + $table->primary(['company_id', 'user_id']); + $table->foreign('user_id')->references('id')->on('users'); + $table->foreign('company_id')->references('id')->on('companies'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('employees'); + } +}