Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx
This commit is contained in:
@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('users', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->string('contact_code', 50)->unique()->nullable()->comment('Código único del contacto');
|
||||
|
||||
$table->string('name', 100)->comment('Nombre')->index();
|
||||
$table->string('last_name', 100)->comment('Apellidos')->nullable()->index();
|
||||
|
||||
$table->string('email')->unique()->index();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password')->nullable();
|
||||
$table->rememberToken();
|
||||
$table->string('profile_photo_path', 2048)->nullable();
|
||||
|
||||
$table->string('company', 100)->nullable()->comment('Nombre de la empresa')->index();
|
||||
|
||||
$table->date('birth_date')->nullable()->comment('Fecha de nacimiento');
|
||||
$table->date('hire_date')->nullable()->comment('Fecha de contratación');
|
||||
|
||||
$table->string('curp', 50)->nullable()->comment('Clave Única de Registro de Población (CURP)')->index();
|
||||
$table->string('nss', 11)->nullable()->comment('Número de seguridad social')->index();
|
||||
|
||||
$table->string('job_title', 100)->nullable()->comment('Cargo del contacto en la empresa');
|
||||
|
||||
$table->json('face_vector')->nullable()->comment('Vector de características faciales');
|
||||
|
||||
$table->string('rfc', 13)->unique()->nullable()->index();
|
||||
$table->string('nombre_fiscal')->nullable()->index();
|
||||
|
||||
$table->unsignedTinyInteger('tipo_persona')->nullable()->index();
|
||||
|
||||
$table->unsignedSmallInteger('c_regimen_fiscal')->nullable()->index(); // sat_regimen_fiscal.c_regimen_fiscal
|
||||
|
||||
$table->unsignedMediumInteger('domicilio_fiscal')->nullable()->index(); // sat_codigo_postal.c_codigo_postal
|
||||
|
||||
$table->char('c_uso_cfdi', 4)->charset('ascii')->collation('ascii_general_ci')->nullable()->index(); // sat_uso_cfdi.c_uso_cfdi
|
||||
|
||||
$table->unsignedTinyInteger('is_partner')->nullable()->index();
|
||||
$table->unsignedTinyInteger('is_employee')->nullable()->index();
|
||||
$table->unsignedTinyInteger('is_prospect')->nullable()->index();
|
||||
$table->unsignedTinyInteger('is_customer')->nullable()->index();
|
||||
$table->unsignedTinyInteger('is_provider')->nullable()->index();
|
||||
$table->unsignedTinyInteger('is_user')->nullable()->index();
|
||||
|
||||
$table->unsignedTinyInteger('status')->nullable()->index();
|
||||
|
||||
// Auditoría
|
||||
$table->dateTime('last_login_at')->nullable();
|
||||
$table->ipAddress('last_login_ip')->nullable();
|
||||
|
||||
$table->unsignedMediumInteger('created_by')->nullable()->index(); // users.id
|
||||
$table->timestamps();
|
||||
|
||||
// Relaciones
|
||||
$table->foreign('created_by')->references('id')->on('users')->onUpdate('restrict')->onDelete('restrict');
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('sessions', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->foreignId('user_id')->nullable()->index();
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->longText('payload');
|
||||
$table->integer('last_activity')->index();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('user_logins', function (Blueprint $table) {
|
||||
$table->integerIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('user_id')->nullable()->index();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Relaciones
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_logins');
|
||||
}
|
||||
};
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('personal_access_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->morphs('tokenable');
|
||||
$table->string('name');
|
||||
$table->string('token', 64)->unique();
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('personal_access_tokens');
|
||||
}
|
||||
};
|
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
//$table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('group_name')->nullable()->index();
|
||||
$table->string('sub_group_name')->nullable()->index();
|
||||
$table->string('action')->nullable()->index();
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
$table->unique(['group_name', 'sub_group_name', 'action', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
//$table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('style')->nullable();
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary(
|
||||
[$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary'
|
||||
);
|
||||
} else {
|
||||
$table->primary(
|
||||
[$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary(
|
||||
[$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary'
|
||||
);
|
||||
} else {
|
||||
$table->primary(
|
||||
[$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Laravel\Fortify\Fortify;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->text('two_factor_secret')
|
||||
->after('password')
|
||||
->nullable();
|
||||
|
||||
$table->text('two_factor_recovery_codes')
|
||||
->after('two_factor_secret')
|
||||
->nullable();
|
||||
|
||||
if (Fortify::confirmsTwoFactorAuthentication()) {
|
||||
$table->timestamp('two_factor_confirmed_at')
|
||||
->after('two_factor_recovery_codes')
|
||||
->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(array_merge([
|
||||
'two_factor_secret',
|
||||
'two_factor_recovery_codes',
|
||||
], Fortify::confirmsTwoFactorAuthentication() ? [
|
||||
'two_factor_confirmed_at',
|
||||
] : []));
|
||||
});
|
||||
}
|
||||
};
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$connection = config('audit.drivers.database.connection', config('database.default'));
|
||||
$table = config('audit.drivers.database.table', 'audits');
|
||||
|
||||
Schema::connection($connection)->create($table, function (Blueprint $table) {
|
||||
|
||||
$morphPrefix = config('audit.user.morph_prefix', 'user');
|
||||
|
||||
$table->bigIncrements('id');
|
||||
$table->string($morphPrefix . '_type')->nullable();
|
||||
$table->unsignedBigInteger($morphPrefix . '_id')->nullable();
|
||||
$table->string('event');
|
||||
$table->morphs('auditable');
|
||||
$table->text('old_values')->nullable();
|
||||
$table->text('new_values')->nullable();
|
||||
$table->text('url')->nullable();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent', 1023)->nullable();
|
||||
$table->string('tags')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index([$morphPrefix . '_id', $morphPrefix . '_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$connection = config('audit.drivers.database.connection', config('database.default'));
|
||||
$table = config('audit.drivers.database.table', 'audits');
|
||||
|
||||
Schema::connection($connection)->drop($table);
|
||||
}
|
||||
};
|
@ -0,0 +1,305 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('sat_banco', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedSmallInteger('c_banco')->index();
|
||||
$table->string('descripcion');
|
||||
$table->string('razon_social')->nullable();
|
||||
$table->string('rfc', 13)->nullable();
|
||||
|
||||
$table->unsignedTinyInteger('status');
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('sat_clave_prod_serv', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedInteger('c_clave_prod_serv');
|
||||
$table->string('descripcion')->nullable()->fulltext();
|
||||
$table->string('incluir_iva_trasladado')->nullable();
|
||||
$table->string('incluir_ieps_trasladado')->nullable();
|
||||
$table->string('complemento_que_debe_incluir')->nullable();
|
||||
$table->date('fecha_inicio_vigencia')->nullable();
|
||||
$table->date('fecha_fin_vigencia')->nullable();
|
||||
$table->unsignedTinyInteger('estimulo_franja_fronteriza')->nullable();
|
||||
$table->string('palabras_similares', 1024)->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_clave_prod_serv');
|
||||
});
|
||||
|
||||
Schema::create('sat_clave_unidad', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->string('c_clave_unidad', 3)->unique();
|
||||
$table->string('nombre')->fulltext();
|
||||
$table->string('descripcion', 1024)->nullable();
|
||||
$table->string('categoria', 1024)->nullable();
|
||||
$table->string('nota', 1024)->nullable();
|
||||
$table->date('fecha_de_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_de_fin_de_vigencia')->nullable();
|
||||
$table->string('simbolo')->nullable();
|
||||
$table->boolean('is_base')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('sat_forma_pago', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedTinyInteger('c_forma_pago');
|
||||
$table->string('descripcion');
|
||||
$table->string('bancarizado')->nullable();
|
||||
$table->string('numero_de_operacion')->nullable();
|
||||
$table->string('rfc_del_emisor_de_la_cuenta_ordenante')->nullable();
|
||||
$table->string('cuenta_ordenante')->nullable();
|
||||
$table->string('patron_para_cuenta_ordenante')->nullable();
|
||||
$table->string('rfc_del_emisor_cuenta_de_beneficiario')->nullable();
|
||||
$table->string('cuenta_de_benenficiario')->nullable();
|
||||
$table->string('patron_para_cuenta_beneficiaria')->nullable();
|
||||
$table->string('tipo_cadena_pago')->nullable();
|
||||
$table->string('banco_emisor_de_la_cuenta_ordenante')->nullable();
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_forma_pago');
|
||||
});
|
||||
|
||||
Schema::create('sat_moneda', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->char('c_moneda', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('descripcion');
|
||||
$table->string('decimales')->nullable();
|
||||
$table->string('porcentaje_variacion')->nullable();
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_moneda');
|
||||
});
|
||||
|
||||
Schema::create('sat_codigo_postal', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('c_codigo_postal');
|
||||
$table->string('c_estado', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->unsignedSmallInteger('c_municipio')->nullable();
|
||||
$table->unsignedTinyInteger('c_localidad')->nullable();
|
||||
$table->string('estimulo_franja_fronteriza')->nullable();
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->index('c_codigo_postal');
|
||||
$table->index('c_estado');
|
||||
$table->index('c_municipio');
|
||||
$table->index('c_localidad');
|
||||
|
||||
$table->unique('c_codigo_postal');
|
||||
});
|
||||
|
||||
Schema::create('sat_regimen_fiscal', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedSmallInteger('c_regimen_fiscal');
|
||||
$table->string('descripcion');
|
||||
$table->char('fisica', 2)->nullable();
|
||||
$table->char('moral', 2)->nullable();
|
||||
$table->date('fecha_de_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_de_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_regimen_fiscal');
|
||||
});
|
||||
|
||||
Schema::create('sat_pais', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->char('c_pais', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('descripcion');
|
||||
$table->string('formato_de_codigo_postal')->nullable();
|
||||
$table->string('formato_de_registro_de_identidad_tributaria')->nullable();
|
||||
$table->string('validacion_del_registro_de_identidad_tributaria')->nullable();
|
||||
$table->string('agrupaciones')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_pais');
|
||||
});
|
||||
|
||||
Schema::create('sat_uso_cfdi', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->char('c_uso_cfdi', 4)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('descripcion');
|
||||
$table->char('aplica_para_tipo_persona_fisica', 2)->nullable();
|
||||
$table->char('aplica_para_tipo_persona_moral', 2)->nullable();
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
$table->string('regimen_fiscal_receptor')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->unique('c_uso_cfdi');
|
||||
});
|
||||
|
||||
Schema::create('sat_colonia', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->unsignedMediumInteger('c_colonia');
|
||||
$table->unsignedMediumInteger('c_codigo_postal');
|
||||
$table->string('nombre_del_asentamiento')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->index('c_colonia');
|
||||
$table->index('c_codigo_postal');
|
||||
|
||||
$table->unique(['c_colonia', 'c_codigo_postal']);
|
||||
});
|
||||
|
||||
Schema::create('sat_estado', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->string('c_estado', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->char('c_pais', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('nombre_del_estado');
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->index('c_estado');
|
||||
$table->index('c_pais');
|
||||
|
||||
$table->unique(['c_estado', 'c_pais']);
|
||||
});
|
||||
|
||||
Schema::create('sat_localidad', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedTinyInteger('c_localidad');
|
||||
$table->string('c_estado', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('descripcion');
|
||||
$table->date('fecha_de_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_de_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->index('c_localidad');
|
||||
$table->index('c_estado');
|
||||
|
||||
$table->unique(['c_localidad', 'c_estado']);
|
||||
});
|
||||
|
||||
Schema::create('sat_municipio', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedSmallInteger('c_municipio');
|
||||
$table->string('c_estado', 3)->charset('ascii')->collation('ascii_general_ci');
|
||||
$table->string('descripcion');
|
||||
$table->date('fecha_de_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_de_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
|
||||
// Indices
|
||||
$table->index('c_municipio');
|
||||
$table->index('c_estado');
|
||||
|
||||
$table->unique(['c_municipio', 'c_estado']);
|
||||
});
|
||||
|
||||
Schema::create('sat_deduccion', function (Blueprint $table) {
|
||||
$table->tinyIncrements('id');
|
||||
|
||||
$table->unsignedTinyInteger('c_deduccion')->index();
|
||||
$table->string('descripcion');
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('sat_percepcion', function (Blueprint $table) {
|
||||
$table->smallIncrements('id');
|
||||
|
||||
$table->unsignedTinyInteger('c_percepcion')->index();
|
||||
$table->string('descripcion');
|
||||
$table->date('fecha_inicio_de_vigencia')->nullable();
|
||||
$table->date('fecha_fin_de_vigencia')->nullable();
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
// Indices
|
||||
$table->foreign('c_regimen_fiscal')
|
||||
->references('c_regimen_fiscal')
|
||||
->on('sat_regimen_fiscal')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('domicilio_fiscal')
|
||||
->references('c_codigo_postal')
|
||||
->on('sat_codigo_postal')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
|
||||
$table->foreign('c_uso_cfdi')
|
||||
->references('c_uso_cfdi')
|
||||
->on('sat_uso_cfdi')
|
||||
->onUpdate('restrict')
|
||||
->onDelete('restrict');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('sat_forma_pago');
|
||||
Schema::dropIfExists('sat_moneda');
|
||||
Schema::dropIfExists('sat_codigo_postal');
|
||||
Schema::dropIfExists('sat_regimen_fiscal');
|
||||
Schema::dropIfExists('sat_pais');
|
||||
Schema::dropIfExists('sat_uso_cfdi');
|
||||
Schema::dropIfExists('sat_colonia');
|
||||
Schema::dropIfExists('sat_estado');
|
||||
Schema::dropIfExists('sat_localidad');
|
||||
Schema::dropIfExists('sat_municipio');
|
||||
}
|
||||
};
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
$table->string('key')->index();
|
||||
$table->text('value');
|
||||
$table->unsignedMediumInteger('user_id')->nullable()->index();
|
||||
|
||||
// Unique constraints
|
||||
$table->unique(['user_id', 'key']);
|
||||
|
||||
// Relaciones
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('media_items', function (Blueprint $table) {
|
||||
$table->mediumIncrements('id');
|
||||
|
||||
// Relación polimórfica
|
||||
$table->unsignedMediumInteger('mediaable_id');
|
||||
$table->string('mediaable_type');
|
||||
|
||||
$table->unsignedTinyInteger('type')->index(); // Tipo de medio: 'image', 'video', 'file', 'youtube'
|
||||
$table->unsignedTinyInteger('sub_type')->index(); // Subtipo de medio: 'thumbnail', 'main', 'additional'
|
||||
|
||||
$table->string('url', 255)->nullable(); // URL del medio
|
||||
$table->string('path')->nullable(); // Ruta del archivo si está almacenado localmente
|
||||
|
||||
$table->string('title')->nullable()->index(); // Título del medio
|
||||
$table->mediumText('description')->nullable(); // Descripción del medio
|
||||
$table->unsignedTinyInteger('order')->nullable(); // Orden de presentación
|
||||
|
||||
// Authoría
|
||||
$table->timestamps();
|
||||
|
||||
// Índices
|
||||
$table->index(['mediaable_type', 'mediaable_id']);
|
||||
$table->index(['mediaable_type', 'mediaable_id', 'type']);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('images');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user