fixed migrations, changed settings to global settings, changed image list to have a "delete all" button instead of "create", fixed printing, added imagick for printing.

This commit is contained in:
2025-08-26 10:39:18 +02:00
parent 44dd0f2867
commit 9b1f6a479f
69 changed files with 17232 additions and 1263 deletions

View File

@@ -1,32 +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::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};

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::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('password_reset_tokens');
}
};

View File

@@ -1,32 +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::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('failed_jobs');
}
};

View File

@@ -1,33 +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::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

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::create('roles', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('roles');
}
};

View File

@@ -1,29 +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('users', function (Blueprint $table) {
$table->foreignId('role_id')->constrained()->default(2);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropForeign(['role_id']);
$table->dropColumn('role_id');
});
}
};

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::create('images', function (Blueprint $table) {
$table->id();
$table->string('path');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('images');
}
};

View File

@@ -1,32 +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::create('api_providers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('api_url');
$table->string('username')->nullable();
$table->string('password')->nullable();
$table->string('token')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('api_providers');
}
};

View File

@@ -1,29 +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::create('ai_models', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('model_type');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ai_models');
}
};

View File

@@ -1,32 +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::create('styles', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('prompt');
$table->text('description');
$table->string('preview_image');
$table->foreignId('api_provider_id')->constrained();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('styles');
}
};

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('images', function (Blueprint $table) {
$table->uuid('uuid')->after('id')->nullable()->unique();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('images', function (Blueprint $table) {
$table->dropColumn('uuid');
});
}
};

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('api_providers', function (Blueprint $table) {
$table->string('plugin')->nullable()->after('token');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('api_providers', function (Blueprint $table) {
$table->dropColumn('plugin');
});
}
};

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('ai_models', function (Blueprint $table) {
$table->string('model_id')->after('name');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ai_models', function (Blueprint $table) {
$table->dropColumn('model_id');
});
}
};

View File

@@ -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('styles', function (Blueprint $table) {
$table->dropConstrainedForeignId('api_provider_id');
$table->foreignId('ai_model_id')->constrained()->after('preview_image');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('styles', function (Blueprint $table) {
$table->dropConstrainedForeignId('ai_model_id');
$table->foreignId('api_provider_id')->constrained();
});
}
};

View File

@@ -1,36 +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('ai_models', function (Blueprint $table) {
// Check if the column exists before trying to modify it
if (Schema::hasColumn('ai_models', 'api_provider_id')) {
$table->unsignedBigInteger('api_provider_id')->nullable()->change();
} else {
// If the column doesn't exist, add it as nullable
$table->foreignId('api_provider_id')->nullable()->constrained()->after('model_type');
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ai_models', function (Blueprint $table) {
// Revert logic if needed, but for this specific case, it might be complex
// to revert a nullable change or a column addition if data exists.
// Consider the implications of rolling back this specific migration.
});
}
};

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::create('ai_model_api_provider', function (Blueprint $table) {
$table->foreignId('ai_model_id')->constrained()->onDelete('cascade');
$table->foreignId('api_provider_id')->constrained()->onDelete('cascade');
$table->primary(['ai_model_id', 'api_provider_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ai_model_api_provider');
}
};

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('styles', function (Blueprint $table) {
$table->text('parameters')->nullable()->after('preview_image');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('styles', function (Blueprint $table) {
$table->dropColumn('parameters');
});
}
};

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('api_providers', function (Blueprint $table) {
$table->boolean('enabled')->default(true)->after('name');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('api_providers', function (Blueprint $table) {
$table->dropColumn('enabled');
});
}
};

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('styles', function (Blueprint $table) {
$table->boolean('enabled')->default(true)->after('ai_model_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('styles', function (Blueprint $table) {
$table->dropColumn('enabled');
});
}
};

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::create('settings', function (Blueprint $table) {
$table->string('key')->primary();
$table->text('value')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};

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('ai_models', function (Blueprint $table) {
$table->boolean('enabled')->default(true)->after('model_type');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ai_models', function (Blueprint $table) {
$table->dropColumn('enabled');
});
}
};

View File

@@ -1,36 +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('images', function (Blueprint $table) {
$table->unsignedBigInteger('original_image_id')->nullable()->after('id');
$table->foreign('original_image_id')->references('id')->on('images')->onDelete('set null');
$table->unsignedInteger('style_id')->nullable()->after('original_image_id');
$table->foreign('style_id')->references('id')->on('styles')->onDelete('set null');
$table->boolean('is_temp')->default(false)->after('style_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('images', function (Blueprint $table) {
$table->dropForeign(['original_image_id']);
$table->dropColumn('original_image_id');
$table->dropForeign(['style_id']);
$table->dropColumn('style_id');
$table->dropColumn('is_temp');
});
}
};

View File

@@ -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('users', function (Blueprint $table) {
$table->boolean('email_notifications_enabled')->default(true);
$table->string('theme_preference')->default('light');
$table->string('locale')->default('en');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['email_notifications_enabled', 'theme_preference', 'locale']);
});
}
};

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('images', function (Blueprint $table) {
$table->boolean('is_public')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('images', function (Blueprint $table) {
$table->dropColumn('is_public');
});
}
};

View File

@@ -1,39 +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('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->nullable();
$table->text('two_factor_recovery_codes')
->nullable();
$table->timestamp('two_factor_confirmed_at')
->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn([
'two_factor_secret',
'two_factor_recovery_codes',
'two_factor_confirmed_at',
]);
});
}
};

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('images', function (Blueprint $table) {
$table->string('comfyui_prompt_id')->nullable()->after('uuid');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('images', function (Blueprint $table) {
$table->dropColumn('comfyui_prompt_id');
});
}
};

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('ai_models', function (Blueprint $table) {
$table->json('parameters')->nullable();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('ai_models', function (Blueprint $table) {
$table->dropColumn('parameters');
});
}
};

View File

@@ -1,45 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::rename('settings', 'settings_old');
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->text('value')->nullable();
$table->timestamps();
});
$oldSettings = DB::table('settings_old')->get();
foreach ($oldSettings as $setting) {
DB::table('settings')->insert((array)$setting);
}
Schema::drop('settings_old');
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
Schema::create('settings', function (Blueprint $table) {
$table->string('key')->primary();
$table->text('value')->nullable();
$table->timestamps();
});
}
};

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('styles', function (Blueprint $table) {
$table->integer('sort_order')->default(0)->after('enabled');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('styles', function (Blueprint $table) {
$table->dropColumn('sort_order');
});
}
};

View File

@@ -0,0 +1,145 @@
<?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::create('roles', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
$table->foreignId('role_id')->constrained()->default(2);
$table->boolean('email_notifications_enabled')->default(true);
$table->string('theme_preference')->default('light');
$table->string('locale')->default('en');
$table->text('two_factor_secret')->nullable();
$table->text('two_factor_recovery_codes')->nullable();
$table->timestamp('two_factor_confirmed_at')->nullable();
});
Schema::create('api_providers', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->boolean('enabled')->default(true);
$table->string('api_url');
$table->string('username')->nullable();
$table->string('password')->nullable();
$table->string('token')->nullable();
$table->string('plugin')->nullable();
$table->timestamps();
});
Schema::create('ai_models', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('model_id');
$table->string('model_type');
$table->boolean('enabled')->default(true);
$table->foreignId('api_provider_id')->nullable()->constrained();
$table->json('parameters')->nullable();
$table->timestamps();
});
Schema::create('styles', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->text('prompt');
$table->text('description');
$table->string('preview_image');
$table->text('parameters')->nullable();
$table->foreignId('ai_model_id')->constrained();
$table->boolean('enabled')->default(true);
$table->integer('sort_order')->default(0);
$table->timestamps();
});
Schema::create('images', function (Blueprint $table) {
$table->id();
$table->uuid('uuid')->nullable()->unique();
$table->string('comfyui_prompt_id')->nullable();
$table->unsignedBigInteger('original_image_id')->nullable();
$table->foreign('original_image_id')->references('id')->on('images')->onDelete('set null');
$table->unsignedInteger('style_id')->nullable();
$table->foreign('style_id')->references('id')->on('styles')->onDelete('set null');
$table->boolean('is_temp')->default(false);
$table->string('path');
$table->boolean('is_public')->default(false);
$table->timestamps();
});
Schema::create('settings', function (Blueprint $table) {
$table->id();
$table->string('key')->unique();
$table->text('value')->nullable();
$table->timestamps();
});
Schema::create('ai_model_api_provider', function (Blueprint $table) {
$table->foreignId('ai_model_id')->constrained()->onDelete('cascade');
$table->foreignId('api_provider_id')->constrained()->onDelete('cascade');
$table->primary(['ai_model_id', 'api_provider_id']);
});
Schema::create('password_reset_tokens', function (Blueprint $table) {
$table->string('email')->primary();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id();
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
Schema::create('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
Schema::dropIfExists('failed_jobs');
Schema::dropIfExists('password_reset_tokens');
Schema::dropIfExists('ai_model_api_provider');
Schema::dropIfExists('settings');
Schema::dropIfExists('images');
Schema::dropIfExists('styles');
Schema::dropIfExists('ai_models');
Schema::dropIfExists('api_providers');
Schema::dropIfExists('users');
Schema::dropIfExists('roles');
}
};