43 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| use Illuminate\Database\Migrations\Migration;
 | |
| use Illuminate\Database\Schema\Blueprint;
 | |
| use Illuminate\Support\Facades\Schema;
 | |
| 
 | |
| class CreateSubpedidosTable extends Migration
 | |
| {
 | |
|     /**
 | |
|      * Run the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function up()
 | |
|     {
 | |
|         Schema::create('subpedidos', function (Blueprint $table) {
 | |
|             $table->id();
 | |
|             $table->string('nombre');
 | |
|             $table->foreignId('grupo_de_compra_id');
 | |
|             $table->boolean('aprobado')->default(false);
 | |
|             $table->timestamps();
 | |
|         });
 | |
| 
 | |
|         Schema::create('producto_subpedido', function (Blueprint $table) {
 | |
|             $table->id();
 | |
|             $table->foreignId('subpedido_id');
 | |
|             $table->foreignId('producto_id');
 | |
|             $table->integer('cantidad')->default(0);
 | |
|             $table->timestamps();
 | |
|         });
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Reverse the migrations.
 | |
|      *
 | |
|      * @return void
 | |
|      */
 | |
|     public function down()
 | |
|     {
 | |
|         Schema::dropIfExists('producto_subpedido');
 | |
|         Schema::dropIfExists('subpedidos');
 | |
|     }
 | |
| }
 | 
