feature/modelos-y-migraciones #3
|
@ -13,7 +13,13 @@ public function up(): void
|
|||
{
|
||||
Schema::create('productos', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name', 100);
|
||||
$table->double('price', 15, 2);
|
||||
$table->unsignedBigInteger('categoria_id');
|
||||
$table->boolean('solidario');
|
||||
$table->boolean('bono');
|
||||
$table->timestamps();
|
||||
$table->foreign('categoria_id')->references('id')->on('categorias');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?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::table('productos', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('categoria_id')->after('id');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('productos', function (Blueprint $table) {
|
||||
$table->dropColumn('categoria_id');
|
||||
});
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue