trypost/database/migrations/2026_01_14_232323_create_medias_table.php
Paulo Castellano 42d5adeb1a refactor: consolidate billing migrations into original files
Instead of separate alter-table migrations, edit the original
create_table migrations directly since we're resetting the database.

- Users table: removed stripe_id, pm_type, pm_last_four, trial_ends_at
- Workspaces table: added plan_id, stripe_id, pm_type, pm_last_four, trial_ends_at
- Subscriptions table: changed user_id FK to workspace_id FK
- Social accounts table: added brand_id FK
- Plans and brands tables ordered before their dependents
- Deleted 5 redundant alter-table migrations
2026-04-14 18:59:43 -03:00

41 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
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::create('medias', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->uuid('group_id')->nullable()->index();
$table->uuidMorphs('mediable');
$table->string('collection')->default('default');
$table->string('type');
$table->string('path');
$table->string('original_filename');
$table->string('mime_type');
$table->unsignedBigInteger('size');
$table->unsignedInteger('order')->default(0);
$table->json('meta')->nullable();
$table->timestamps();
$table->index(['mediable_type', 'mediable_id', 'collection']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('medias');
}
};