First commit

This commit is contained in:
2026-01-13 20:46:44 -06:00
commit d63e4e823a
241 changed files with 59142 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateIChambaParametersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('i_chamba_parameters', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('parameter');
$table->float('num_value')->nullable();
$table->string('string_value')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('i_chamba_parameters');
}
}

View File

@@ -0,0 +1,31 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRolesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('roles', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('roles');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique()->nullable();
$table->string('profile_photo')->nullable();
$table->BigInteger('role_id')->unsigned()->nullable();
$table->string('social_id')->unique()->nullable();
$table->string('openpay_id')->unique()->nullable();
$table->string('phone')->unique()->nullable();
$table->timestamp('phone_verified_at')->nullable();
$table->string('password')->nullable();
$table->boolean('reported')->default(false);
$table->Integer('strikes')->nullable()->default(0);
$table->rememberToken();
$table->timestamps();
$table->foreign('role_id')->references('id')->on('roles')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateLinkedSocialAccountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('linked_social_accounts', function (Blueprint $table) {
$table->increments('id');
$table->string('provider_id');
$table->string('provider_name');
$table->unsignedBigInteger('user_id');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('linked_social_accounts');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVerifyAccounts extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('verify_accounts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email');
$table->string('password');
$table->string('token')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('verify_accounts');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCardsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cards', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->string('token');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cards');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBanksTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('banks', function (Blueprint $table) {
$table->bigIncrements('id');
$table->Integer('code');
$table->string('name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('banks');
}
}

View File

@@ -0,0 +1,54 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSuppliersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('suppliers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->nullable();
$table->string('company_name');
$table->boolean('membership')->default(false);
$table->string('cover_photo')->nullable();
$table->string('tags')->nullable();
$table->string('description')->nullable();
$table->string('CURP', 18)->unique()->nullable();
$table->string('RFC', 14)->unique()->nullable();
$table->string('regimen')->nullable();
$table->string('clabe')->unique()->nullable();
$table->unsignedBigInteger('bank_id')->nullable();
$table->float('minimun_fee')->nullable();
$table->unsignedBigInteger('IVA_id')->nullable();
$table->unsignedBigInteger('ISR_id')->nullable();
$table->unsignedBigInteger('finished_jobs')->default(1);
$table->unsignedBigInteger('total_score')->default(3);
$table->string('address')->nullable();
$table->point('location')->nullable();
$table->boolean('en')->default(false);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
$table->foreign('bank_id')->references('id')->on('banks')->onDelete('set null');
$table->foreign('IVA_id')->references('id')->on('i_chamba_parameters')->onDelete('set null');
$table->foreign('ISR_id')->references('id')->on('i_chamba_parameters')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('suppliers');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('en_name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categories');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateStatusTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('statuses', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('en_name');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('statuses');
}
}

View File

@@ -0,0 +1,45 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostulationsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('postulations', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('category_id')->nullable();
$table->string('address');
$table->string('int_number')->nullable();
$table->text('references')->nullable();
$table->point('location');
$table->timestamp('appointment')->nullable();
$table->float('amount');
$table->text('details')->nullable();
$table->boolean('en')->default(false);
$table->unsignedBigInteger('status_id')->nullable()->default('1');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->foreign('category_id')->references('id')->on('categories')->onDelete('set null');
$table->foreign('status_id')->references('id')->on('statuses')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('postulations');
}
}

View File

@@ -0,0 +1,35 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePostulationSupplierTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('postulations_suppliers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('postulations_id');
$table->unsignedBigInteger('suppliers_id');
$table->foreign('postulations_id')->references('id')->on('postulations')->onDelete('cascade');
$table->foreign('suppliers_id')->references('id')->on('suppliers')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('postulations_suppliers');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesSuppliersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories_suppliers', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('suppliers_id');
$table->unsignedBigInteger('categories_id')->nullable();
$table->foreign('suppliers_id')->references('id')->on('suppliers')->onDelete('cascade');
$table->foreign('categories_id')->references('id')->on('categories')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categories_suppliers');
}
}

View File

@@ -0,0 +1,58 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFinishedcontractsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('finished_contracts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->nullable();
$table->unsignedBigInteger('supplier_id')->nullable();
$table->unsignedBigInteger('category_id')->nullable();
$table->string('address');
$table->string('int_number');
$table->text('references')->nullable();
$table->point('location');
$table->timestamp('appointment')->nullable();
$table->float('amount');
$table->float('IVA');
$table->float('ISR');
$table->float('ichamba_fee');
$table->float('revenue');
$table->text('details')->nullable();
$table->text('comments')->nullable();
$table->boolean('en')->default(false);
$table->string('transaction_id');
$table->unsignedBigInteger('status_id')->nullable()->default('3');
$table->unsignedBigInteger('parent_contract_id')->nullable();
$table->Integer('score')->nullable();
$table->timestamp('scored_at')->nullable();
$table->boolean('paid')->default(false);
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
$table->foreign('category_id')->references('id')->on('categories')->onDelete('set null');
$table->foreign('status_id')->references('id')->on('statuses')->onDelete('set null');
$table->foreign('parent_contract_id')->references('id')->on('finished_contracts')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('finished_contracts');
}
}

View File

@@ -0,0 +1,55 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCurrentContractsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('current_contracts', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('user_id')->nullable();
$table->unsignedBigInteger('supplier_id')->nullable();
$table->unsignedBigInteger('category_id')->nullable();
$table->string('address');
$table->string('int_number');
$table->text('references')->nullable();
$table->point('location');
$table->timestamp('appointment')->nullable();
$table->float('amount');
$table->float('IVA');
$table->float('ISR');
$table->float('ichamba_fee');
$table->float('revenue');
$table->text('details')->nullable();
$table->boolean('en')->default(false);
$table->string('transaction_id');
$table->unsignedBigInteger('status_id')->nullable()->default('1');
$table->BigInteger('code')->nullable();
$table->unsignedBigInteger('parent_contract_id')->nullable();
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
$table->foreign('category_id')->references('id')->on('categories')->onDelete('set null');
$table->foreign('status_id')->references('id')->on('statuses')->onDelete('set null');
$table->foreign('parent_contract_id')->references('id')->on('finished_contracts')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('current_contracts');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePaymentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('payments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contract_id');
$table->unsignedBigInteger('supplier_id')->nullable();
$table->unsignedBigInteger('status_id')->nullable();
$table->float('amount');
$table->timestamps();
$table->foreign('contract_id')->references('id')->on('finished_contracts')->onDelete('cascade');
$table->foreign('supplier_id')->references('id')->on('suppliers')->onDelete('set null');
$table->foreign('status_id')->references('id')->on('statuses')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('payments');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateReportsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('reports', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contract_id');
$table->unsignedBigInteger('moderator_id')->nullable();
$table->text('veredict')->nullable();
$table->timestamps();
$table->foreign('contract_id')->references('id')->on('finished_contracts')->onDelete('cascade');
$table->foreign('moderator_id')->references('id')->on('users')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('reports');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateReportCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('report_comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('report_id');
$table->unsignedBigInteger('user_id')->nullable();
$table->text('comment')->nullable();
$table->timestamps();
$table->foreign('report_id')->references('id')->on('reports')->onDelete('cascade');
$table->foreign('user_id')->references('id')->on('users')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('report_comments');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateNoHomesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('no_homes', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('contract_id');
$table->string('house_photo')->nullable();
$table->string('house_description')->nullable();
$table->point('location')->nullable();
$table->timestamp('confirmed_at')->nullable();
$table->timestamps();
$table->foreign('contract_id')->references('id')->on('finished_contracts')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('no_homes');
}
}

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddReferencesToSuppliers extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('suppliers', function (Blueprint $table) {
//
$table->string('references')->nullable()->after('address');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('suppliers', function (Blueprint $table) {
//
$table->dropColumn('references');
});
}
}

View File

@@ -0,0 +1,60 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCouponsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('coupons', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->float('percentage')->nullable();
$table->float('amount')->nullable();
$table->float('limit')->nullable();
$table->timestamp('expire_at')->nullable();
$table->timestamps();
});
Schema::table('current_contracts', function (Blueprint $table) {
//
$table->unsignedBigInteger('coupon_id')->after('en')->nullable();
$table->foreign('coupon_id')->references('id')->on('coupons')->onDelete('set null');
});
Schema::table('finished_contracts', function (Blueprint $table) {
//
$table->unsignedBigInteger('coupon_id')->after('en')->nullable();
$table->foreign('coupon_id')->references('id')->on('coupons')->onDelete('set null');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('coupons');
Schema::table('current_contracts', function (Blueprint $table) {
//
$table->dropForeign(['coupon_id']);
$table->dropColumn('coupon_id');
});
Schema::table('finished_contracts', function (Blueprint $table) {
//
$table->dropForeign(['coupon_id']);
$table->dropColumn('coupon_id');
});
}
}