condensing migrations
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
2026-04-10 09:52:27 -06:00
parent d9cb44e93c
commit cc4d22acb7
5 changed files with 2 additions and 87 deletions
@@ -15,6 +15,7 @@ return new class extends Migration
$table->id(); $table->id();
$table->string('name'); $table->string('name');
$table->text('description'); $table->text('description');
$table->string('image_url')->nullable();
$table->unsignedInteger('price_cents'); $table->unsignedInteger('price_cents');
$table->timestamps(); $table->timestamps();
}); });
@@ -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('products', function (Blueprint $table) {
$table->string('image_url')->nullable()->after('description');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('image_url');
});
}
};
@@ -13,7 +13,7 @@ return new class extends Migration
{ {
Schema::create('carts', function (Blueprint $table) { Schema::create('carts', function (Blueprint $table) {
$table->id(); $table->id();
$table->foreignId('user_id')->constrained(); $table->foreignId('user_id')->nullable();
$table->timestamp('stale_date')->nullable(); $table->timestamp('stale_date')->nullable();
$table->timestamps(); $table->timestamps();
}); });
@@ -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('carts', function (Blueprint $table) {
$table->unique('user_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('carts', function (Blueprint $table) {
$table->dropUnique(['user_id']);
});
}
};
@@ -1,30 +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('carts', function (Blueprint $table) {
$table->dropUnique(['user_id']);
$table->foreignId('user_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('carts', function (Blueprint $table) {
$table->foreignId('user_id')->nullable(false)->change();
$table->unique('user_id');
});
}
};