Laravel app with a cost-tracked Runware.ai integration (image, video, text generation), a hard monthly EUR budget cap with live USD/EUR FX conversion, and a locally-maintained model/pricing table since Runware's model-search API doesn't expose pricing.
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('generations', function (Blueprint $table) {
|
|
$table->id();
|
|
$table->uuid('batch_id')->nullable()->index();
|
|
$table->enum('type', ['image', 'video', 'text']);
|
|
$table->string('model');
|
|
$table->text('prompt')->nullable();
|
|
$table->json('params')->nullable();
|
|
$table->enum('status', ['pending', 'processing', 'completed', 'failed'])->default('pending');
|
|
$table->uuid('runware_task_uuid')->nullable()->unique();
|
|
$table->decimal('cost_usd', 10, 6)->nullable();
|
|
$table->decimal('cost_eur', 10, 6)->nullable();
|
|
$table->boolean('cost_is_estimated')->default(false);
|
|
$table->string('output_path')->nullable();
|
|
$table->longText('output_text')->nullable();
|
|
$table->text('error')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index('created_at');
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('generations');
|
|
}
|
|
};
|