chanchullo de atributos

This commit is contained in:
Alejandro Tasistro 2024-03-12 17:53:06 -03:00
parent 908ee6a496
commit b4c9c5b14e
2 changed files with 6 additions and 28 deletions

View File

@ -13,7 +13,13 @@ public function up(): void
{ {
Schema::create('productos', function (Blueprint $table) { Schema::create('productos', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name', 100);
$table->double('price', 15, 2);
$table->unsignedBigInteger('categoria_id');
$table->boolean('solidario');
$table->boolean('bono');
$table->timestamps(); $table->timestamps();
$table->foreign('categoria_id')->references('id')->on('categorias');
}); });
} }

View File

@ -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');
});
}
};