up
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('confeccions', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('confeccions', 'descuentos_cobros')) {
|
||||
$table->decimal('descuentos_cobros', 12, 2)->default(0)->after('total_pagar');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('confeccions', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('confeccions', 'descuentos_cobros')) {
|
||||
$table->dropColumn('descuentos_cobros');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('cobros', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('referencia_type');
|
||||
$table->unsignedBigInteger('referencia_id');
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->integer('cantidad')->default(0);
|
||||
$table->decimal('valor', 12, 2)->default(0);
|
||||
$table->text('notas')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['referencia_type', 'referencia_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('cobros');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ajustes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('referencia_type');
|
||||
$table->unsignedBigInteger('referencia_id');
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->string('tipo')->default('arreglo');
|
||||
$table->integer('cantidad')->default(0);
|
||||
$table->text('notas')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['referencia_type', 'referencia_id']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ajustes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('prensillas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('proveedor_id')->nullable();
|
||||
$table->unsignedBigInteger('orden_produccion_id');
|
||||
$table->date('fecha_envio')->nullable();
|
||||
$table->integer('cantidad_enviada')->default(0);
|
||||
$table->date('fecha_recepcion')->nullable();
|
||||
$table->integer('cantidad_recibida')->nullable();
|
||||
$table->integer('perdidas')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('proveedor_id')->references('id')->on('proveedors')->onDelete('set null');
|
||||
$table->foreign('orden_produccion_id')->references('id')->on('orden_produccions')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('prensillas');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('ojales', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('proveedor_id')->nullable();
|
||||
$table->unsignedBigInteger('orden_produccion_id');
|
||||
$table->date('fecha_envio')->nullable();
|
||||
$table->integer('cantidad_enviada')->default(0);
|
||||
$table->date('fecha_recepcion')->nullable();
|
||||
$table->integer('cantidad_recibida')->nullable();
|
||||
$table->integer('perdidas')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreign('proveedor_id')->references('id')->on('proveedors')->onDelete('set null');
|
||||
$table->foreign('orden_produccion_id')->references('id')->on('orden_produccions')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('ojales');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tintorerias', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('tintorerias', 'descuentos_cobros')) {
|
||||
$table->decimal('descuentos_cobros', 12, 2)->default(0)->after('perdidas');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tintorerias', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('tintorerias', 'descuentos_cobros')) {
|
||||
$table->dropColumn('descuentos_cobros');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('inventario_prenda_distribuciones', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('inventario_prenda_distribuciones', 'proveedor_id')) {
|
||||
$table->unsignedBigInteger('proveedor_id')->nullable()->after('bodega_id');
|
||||
$table->foreign('proveedor_id')->references('id')->on('proveedors')->onDelete('set null');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('inventario_prenda_distribuciones', function (Blueprint $table) {
|
||||
if (Schema::hasColumn('inventario_prenda_distribuciones', 'proveedor_id')) {
|
||||
$table->dropForeign(['proveedor_id']);
|
||||
$table->dropColumn('proveedor_id');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('inventario_prenda_distribuciones', function (Blueprint $table) {
|
||||
// Drop existing foreign key then make the column nullable and re-add foreign key
|
||||
$table->dropForeign(['bodega_id']);
|
||||
$table->unsignedBigInteger('bodega_id')->nullable()->change();
|
||||
$table->foreign('bodega_id')->references('id')->on('bodegas')->nullOnDelete();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('inventario_prenda_distribuciones', function (Blueprint $table) {
|
||||
$table->dropForeign(['bodega_id']);
|
||||
$table->unsignedBigInteger('bodega_id')->nullable(false)->change();
|
||||
$table->foreign('bodega_id')->references('id')->on('bodegas')->cascadeOnDelete();
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user