12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\RegistrationType;
|
||||
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->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value)->after('email');
|
||||
|
||||
$table->enum('registration_type', array_map(
|
||||
static fn (RegistrationType $type): string => $type->value,
|
||||
RegistrationType::cases()
|
||||
))->default(RegistrationType::ExistingLegacy->value)->after('portal');
|
||||
|
||||
$table->string('language', 2)->default('de')->after('registration_type');
|
||||
$table->boolean('is_active')->default(true)->after('language');
|
||||
$table->boolean('is_super_admin')->default(false)->after('is_active');
|
||||
$table->timestamp('last_login_at')->nullable()->after('is_super_admin');
|
||||
$table->string('last_login_ip', 45)->nullable()->after('last_login_at');
|
||||
$table->timestamp('gdpr_consent_at')->nullable()->after('last_login_ip');
|
||||
$table->timestamp('last_seen_at')->nullable()->after('gdpr_consent_at');
|
||||
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable()->after('last_seen_at');
|
||||
$table->unsignedBigInteger('legacy_id')->nullable()->after('legacy_portal');
|
||||
|
||||
$table->softDeletes()->after('updated_at');
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'users_legacy_portal_legacy_id_unique');
|
||||
|
||||
$table->string('password')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropUnique('users_legacy_portal_legacy_id_unique');
|
||||
|
||||
$table->dropColumn([
|
||||
'portal',
|
||||
'registration_type',
|
||||
'language',
|
||||
'is_active',
|
||||
'is_super_admin',
|
||||
'last_login_at',
|
||||
'last_login_ip',
|
||||
'gdpr_consent_at',
|
||||
'last_seen_at',
|
||||
'legacy_portal',
|
||||
'legacy_id',
|
||||
'deleted_at',
|
||||
]);
|
||||
|
||||
$table->string('password')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,134 @@
|
|||
<?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
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), Exception::class, 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
|
||||
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?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('magic_links', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->char('token_hash', 64)->unique();
|
||||
$table->enum('purpose', [
|
||||
'login',
|
||||
'press_release_access',
|
||||
'invoice_access',
|
||||
'initial_setup',
|
||||
])->default('login');
|
||||
$table->json('payload')->nullable();
|
||||
$table->timestamp('expires_at');
|
||||
$table->timestamp('consumed_at')->nullable();
|
||||
$table->string('ip_requested', 45)->nullable();
|
||||
$table->string('ip_consumed', 45)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'purpose', 'consumed_at'], 'magic_links_user_purpose_consumed_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('magic_links');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
<?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('profiles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
|
||||
$table->string('salutation_key', 20)->nullable();
|
||||
$table->string('title', 80)->nullable();
|
||||
$table->string('first_name', 80)->nullable();
|
||||
$table->string('last_name', 80)->nullable();
|
||||
$table->string('phone', 40)->nullable();
|
||||
$table->string('address', 1000)->nullable();
|
||||
$table->string('country_code', 2)->nullable();
|
||||
$table->date('birthdate')->nullable();
|
||||
$table->string('backlink_url')->nullable();
|
||||
$table->boolean('show_stats')->default(false);
|
||||
$table->timestamp('validation_date')->nullable();
|
||||
$table->timestamp('contract_date')->nullable();
|
||||
$table->string('validate_token', 64)->nullable();
|
||||
$table->string('tax_id_number')->nullable();
|
||||
$table->boolean('tax_exempt')->default(false);
|
||||
$table->string('tax_exempt_reason', 1000)->nullable();
|
||||
$table->boolean('disable_footer_code')->default(false);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('profiles');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\CompanyType;
|
||||
use App\Enums\Portal;
|
||||
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('companies', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value);
|
||||
$table->foreignId('owner_user_id')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->enum('type', array_map(
|
||||
static fn (CompanyType $type): string => $type->value,
|
||||
CompanyType::cases()
|
||||
))->default(CompanyType::Company->value);
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->string('address', 1000)->nullable();
|
||||
$table->string('country_code', 2)->nullable();
|
||||
$table->string('phone', 40)->nullable();
|
||||
$table->string('fax', 40)->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->string('website')->nullable();
|
||||
$table->string('logo_path')->nullable();
|
||||
$table->json('logo_variants')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->boolean('disable_footer_code')->default(false);
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['portal', 'slug'], 'companies_portal_slug_unique');
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'companies_legacy_portal_legacy_id_unique');
|
||||
$table->index(['portal', 'is_active'], 'companies_portal_active_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('companies');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?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('company_user', function (Blueprint $table) {
|
||||
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('role', ['member', 'responsible', 'owner'])->default('member');
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary(['company_id', 'user_id']);
|
||||
$table->index(['user_id', 'role'], 'company_user_user_role_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('company_user');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('contacts', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value);
|
||||
$table->string('salutation_key', 20)->nullable();
|
||||
$table->string('title', 80)->nullable();
|
||||
$table->string('first_name', 80)->nullable();
|
||||
$table->string('last_name', 80)->nullable();
|
||||
$table->string('responsibility')->nullable();
|
||||
$table->string('phone', 40)->nullable();
|
||||
$table->string('fax', 40)->nullable();
|
||||
$table->string('email')->nullable();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'contacts_legacy_portal_legacy_id_unique');
|
||||
$table->index(['company_id', 'portal'], 'contacts_company_portal_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contacts');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('categories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('parent_id')->nullable()->constrained('categories')->nullOnDelete();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'categories_legacy_portal_legacy_id_unique');
|
||||
$table->index(['portal', 'is_active'], 'categories_portal_active_idx');
|
||||
$table->index(['parent_id', 'portal'], 'categories_parent_portal_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('categories');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?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('category_translations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('locale', 2);
|
||||
$table->string('name');
|
||||
$table->string('slug');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['category_id', 'locale'], 'category_translations_category_locale_unique');
|
||||
$table->index(['locale', 'slug'], 'category_translations_locale_slug_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('category_translations');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
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('press_releases', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->uuid('uuid')->unique();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('company_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('category_id')->constrained()->restrictOnDelete();
|
||||
$table->string('language', 2)->default('de');
|
||||
$table->string('title');
|
||||
$table->string('slug');
|
||||
$table->mediumText('text');
|
||||
$table->string('backlink_url')->nullable();
|
||||
$table->string('keywords')->nullable();
|
||||
$table->enum('status', array_map(
|
||||
static fn (PressReleaseStatus $status): string => $status->value,
|
||||
PressReleaseStatus::cases()
|
||||
))->default(PressReleaseStatus::Draft->value);
|
||||
$table->unsignedInteger('hits')->default(0);
|
||||
$table->unsignedInteger('teaser_begin')->default(0);
|
||||
$table->unsignedInteger('teaser_end')->default(0);
|
||||
$table->boolean('no_export')->default(false);
|
||||
$table->timestamp('published_at')->nullable();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['portal', 'language', 'slug'], 'press_releases_portal_language_slug_unique');
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'press_releases_legacy_portal_legacy_id_unique');
|
||||
$table->index(['portal', 'status', 'published_at'], 'press_releases_portal_status_published_idx');
|
||||
$table->index(['category_id', 'portal'], 'press_releases_category_portal_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_releases');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('press_release_images', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('press_release_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('disk', 30)->default('public');
|
||||
$table->string('path', 512);
|
||||
$table->json('variants')->nullable();
|
||||
$table->string('title', 120)->nullable();
|
||||
$table->string('description', 500)->nullable();
|
||||
$table->string('copyright')->nullable();
|
||||
$table->boolean('is_preview')->default(false);
|
||||
$table->unsignedInteger('sort_order')->default(0);
|
||||
$table->unsignedInteger('width')->nullable();
|
||||
$table->unsignedInteger('height')->nullable();
|
||||
$table->string('mime', 60)->nullable();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'press_release_images_legacy_portal_legacy_id_unique');
|
||||
$table->index(['press_release_id', 'sort_order'], 'press_release_images_release_sort_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_release_images');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?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('press_release_contact', function (Blueprint $table) {
|
||||
$table->foreignId('press_release_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('contact_id')->constrained()->cascadeOnDelete();
|
||||
$table->primary(['press_release_id', 'contact_id'], 'press_release_contact_primary');
|
||||
$table->index(['contact_id', 'press_release_id'], 'press_release_contact_contact_release_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_release_contact');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('newsletter_subscriptions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases()
|
||||
))->default(Portal::Both->value);
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('salutation_key', 20)->nullable();
|
||||
$table->string('first_name', 80)->nullable();
|
||||
$table->string('last_name', 80)->nullable();
|
||||
$table->string('email', 190);
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->boolean('is_confirmed')->default(false);
|
||||
$table->string('confirmation_token', 32)->nullable();
|
||||
$table->timestamp('subscribed_at')->nullable();
|
||||
$table->timestamp('unsubscribed_at')->nullable();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['portal', 'email'], 'newsletter_subscriptions_portal_email_unique');
|
||||
$table->unique(['confirmation_token'], 'newsletter_subscriptions_confirmation_token_unique');
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'newsletter_subscriptions_legacy_portal_legacy_id_unique');
|
||||
$table->index(['portal', 'is_confirmed'], 'newsletter_subscriptions_portal_confirmed_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('newsletter_subscriptions');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?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('billing_addresses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->unique()->constrained()->cascadeOnDelete();
|
||||
$table->string('salutation_key', 20)->nullable();
|
||||
$table->string('title', 80)->nullable();
|
||||
$table->string('name', 255);
|
||||
$table->string('address1', 255);
|
||||
$table->string('address2', 255)->nullable();
|
||||
$table->string('postal_code', 20);
|
||||
$table->string('city', 120);
|
||||
$table->string('country_code', 2);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['country_code', 'postal_code'], 'billing_addresses_country_postal_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('billing_addresses');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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('invoice_billing_addresses', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('salutation_key', 20)->nullable();
|
||||
$table->string('title', 80)->nullable();
|
||||
$table->string('name', 255);
|
||||
$table->string('address1', 255);
|
||||
$table->string('address2', 255)->nullable();
|
||||
$table->string('postal_code', 20);
|
||||
$table->string('city', 120);
|
||||
$table->string('country_code', 2);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['country_code', 'postal_code'], 'invoice_billing_country_postal_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoice_billing_addresses');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PaymentOptionType;
|
||||
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('payment_options', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('article_number', 60)->unique();
|
||||
$table->enum('type', array_map(
|
||||
static fn (PaymentOptionType $type): string => $type->value,
|
||||
PaymentOptionType::cases()
|
||||
))->default(PaymentOptionType::Recurring->value);
|
||||
$table->unsignedInteger('price_cents');
|
||||
$table->string('currency', 3)->default('EUR');
|
||||
$table->enum('interval', ['monthly', 'yearly', 'once'])->nullable();
|
||||
$table->boolean('is_hidden')->default(false);
|
||||
$table->string('stripe_product_id', 60)->nullable();
|
||||
$table->string('stripe_price_id', 60)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['type', 'is_hidden'], 'payment_options_type_hidden_idx');
|
||||
$table->index(['stripe_product_id', 'stripe_price_id'], 'payment_options_stripe_ids_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_options');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?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('payment_option_translations', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('payment_option_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('locale', 2);
|
||||
$table->string('name');
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(
|
||||
['payment_option_id', 'locale'],
|
||||
'payment_option_translations_option_locale_unique'
|
||||
);
|
||||
$table->index(['locale', 'name'], 'payment_option_translations_locale_name_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('payment_option_translations');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\UserPaymentOptionStatus;
|
||||
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('user_payment_options', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('payment_option_id')->constrained()->cascadeOnDelete();
|
||||
$table->enum('status', array_map(
|
||||
static fn (UserPaymentOptionStatus $status): string => $status->value,
|
||||
UserPaymentOptionStatus::cases()
|
||||
))->default(UserPaymentOptionStatus::Active->value);
|
||||
$table->date('grandfathered_until')->nullable();
|
||||
$table->json('legacy_conditions')->nullable();
|
||||
$table->date('current_period_start');
|
||||
$table->date('current_period_end');
|
||||
$table->string('stripe_subscription_id', 60)->nullable();
|
||||
$table->timestamp('cancelled_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'status'], 'user_payment_options_user_status_idx');
|
||||
$table->index(['payment_option_id', 'status'], 'user_payment_options_option_status_idx');
|
||||
$table->index(['stripe_subscription_id'], 'user_payment_options_stripe_sub_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_payment_options');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?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('user_payment_option_company', function (Blueprint $table) {
|
||||
$table->foreignId('user_payment_option_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('company_id')->constrained()->cascadeOnDelete();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary(
|
||||
['user_payment_option_id', 'company_id'],
|
||||
'user_payment_option_company_primary'
|
||||
);
|
||||
$table->index(
|
||||
['company_id', 'user_payment_option_id'],
|
||||
'user_payment_option_company_company_option_idx'
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_payment_option_company');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\PaymentStatus;
|
||||
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('user_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_payment_option_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->unsignedInteger('amount_cents');
|
||||
$table->string('currency', 3)->default('EUR');
|
||||
$table->enum('status', array_map(
|
||||
static fn (PaymentStatus $status): string => $status->value,
|
||||
PaymentStatus::cases()
|
||||
))->default(PaymentStatus::Pending->value);
|
||||
$table->string('stripe_charge_id', 60)->nullable();
|
||||
$table->string('stripe_invoice_id', 60)->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_payment_option_id', 'status'], 'user_payments_option_status_idx');
|
||||
$table->index(['stripe_charge_id'], 'user_payments_stripe_charge_idx');
|
||||
$table->index(['stripe_invoice_id'], 'user_payments_stripe_invoice_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_payments');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\InvoiceStatus;
|
||||
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('invoices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_payment_id')->nullable()->constrained('user_payments')->nullOnDelete();
|
||||
$table->foreignId('invoice_billing_address_id')->constrained()->restrictOnDelete();
|
||||
$table->string('number', 40)->unique();
|
||||
$table->enum('status', array_map(
|
||||
static fn (InvoiceStatus $status): string => $status->value,
|
||||
InvoiceStatus::cases()
|
||||
))->default(InvoiceStatus::Open->value);
|
||||
$table->unsignedInteger('amount_cents');
|
||||
$table->unsignedInteger('tax_cents')->default(0);
|
||||
$table->unsignedInteger('total_cents');
|
||||
$table->string('currency', 3)->default('EUR');
|
||||
$table->boolean('is_netto')->default(false);
|
||||
$table->date('invoice_date');
|
||||
$table->date('due_date')->nullable();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->string('stripe_invoice_id', 60)->nullable();
|
||||
$table->string('pdf_path', 512)->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['user_id', 'invoice_date'], 'invoices_user_invoice_date_idx');
|
||||
$table->index(['status', 'invoice_date'], 'invoices_status_invoice_date_idx');
|
||||
$table->index(['stripe_invoice_id'], 'invoices_stripe_invoice_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('invoices');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('legacy_invoices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
]);
|
||||
$table->unsignedBigInteger('legacy_id');
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->unsignedBigInteger('legacy_user_id')->nullable();
|
||||
$table->string('number', 40)->nullable();
|
||||
$table->unsignedInteger('amount_cents')->default(0);
|
||||
$table->unsignedInteger('tax_cents')->default(0);
|
||||
$table->unsignedInteger('total_cents')->default(0);
|
||||
$table->string('status', 40)->nullable();
|
||||
$table->date('invoice_date')->nullable();
|
||||
$table->date('due_date')->nullable();
|
||||
$table->timestamp('paid_at')->nullable();
|
||||
$table->string('payment_method', 40)->nullable();
|
||||
$table->string('pdf_path', 512)->nullable();
|
||||
$table->json('raw_snapshot')->nullable();
|
||||
$table->timestamp('imported_at')->nullable();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'legacy_invoices_portal_legacy_id_unique');
|
||||
$table->index(['user_id', 'invoice_date'], 'legacy_invoices_user_invoice_date_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('legacy_invoices');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('legacy_import_map', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
]);
|
||||
$table->string('legacy_table', 80);
|
||||
$table->unsignedBigInteger('legacy_id');
|
||||
$table->string('target_table', 80);
|
||||
$table->unsignedBigInteger('target_id');
|
||||
$table->timestamp('imported_at')->nullable();
|
||||
|
||||
$table->unique(
|
||||
['legacy_portal', 'legacy_table', 'legacy_id'],
|
||||
'legacy_import_map_portal_table_id_unique'
|
||||
);
|
||||
$table->index(['target_table', 'target_id'], 'legacy_import_map_target_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('legacy_import_map');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
<?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('user_filter_presets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('page', 100);
|
||||
$table->string('name', 120);
|
||||
$table->boolean('is_default')->default(false);
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->json('filters');
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'page', 'name'], 'ufp_user_page_name_unique');
|
||||
$table->index(['user_id', 'page'], 'ufp_user_page_idx');
|
||||
$table->index(['user_id', 'page', 'is_default'], 'ufp_user_page_default_idx');
|
||||
$table->index(['user_id', 'page', 'last_used_at'], 'ufp_user_page_last_used_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_filter_presets');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?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('contact_user', function (Blueprint $table) {
|
||||
$table->foreignId('contact_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
|
||||
$table->primary(['contact_id', 'user_id']);
|
||||
$table->index(['user_id', 'contact_id'], 'contact_user_user_contact_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contact_user');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
/**
|
||||
* Legacy-Daten enthalten Telefonnummern mit Beschreibungstext (bis 93 Zeichen).
|
||||
* VARCHAR(40) reicht nicht aus → auf 255 erweitern.
|
||||
*/
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('phone', 255)->nullable()->change();
|
||||
$table->string('fax', 255)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('phone', 255)->nullable()->change();
|
||||
$table->string('fax', 255)->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->string('phone', 40)->nullable()->change();
|
||||
$table->string('fax', 40)->nullable()->change();
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->string('phone', 40)->nullable()->change();
|
||||
$table->string('fax', 40)->nullable()->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?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('admin_presets', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->string('area')->index();
|
||||
$table->string('type')->default('text');
|
||||
$table->string('label');
|
||||
$table->longText('value')->nullable();
|
||||
$table->json('payload')->nullable();
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('admin_presets');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?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_usage_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->foreignId('personal_access_token_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->string('method', 10);
|
||||
$table->string('path', 512);
|
||||
$table->string('route_name', 120)->nullable();
|
||||
$table->unsignedSmallInteger('status_code');
|
||||
$table->string('ip_address', 45)->nullable();
|
||||
$table->string('user_agent', 512)->nullable();
|
||||
$table->unsignedInteger('duration_ms')->nullable();
|
||||
$table->timestamp('requested_at')->useCurrent();
|
||||
|
||||
$table->index(['user_id', 'requested_at'], 'api_usage_logs_user_requested_idx');
|
||||
$table->index(['personal_access_token_id', 'requested_at'], 'api_usage_logs_token_requested_idx');
|
||||
$table->index(['path', 'requested_at'], 'api_usage_logs_path_requested_idx');
|
||||
$table->index(['status_code', 'requested_at'], 'api_usage_logs_status_requested_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('api_usage_logs');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
<?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('press_releases', function (Blueprint $table) {
|
||||
$table->index(['created_at', 'id'], 'press_releases_created_at_id_idx');
|
||||
$table->index(['status', 'created_at', 'id'], 'press_releases_status_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->index(['created_at', 'id'], 'companies_created_at_id_idx');
|
||||
$table->index(['is_active', 'created_at', 'id'], 'companies_active_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->index(['portal', 'created_at', 'id'], 'contacts_portal_created_at_id_idx');
|
||||
$table->index(['created_at', 'id'], 'contacts_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->index(['is_active', 'created_at', 'id'], 'users_active_created_at_id_idx');
|
||||
$table->index(['portal', 'created_at', 'id'], 'users_portal_created_at_id_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropIndex('users_portal_created_at_id_idx');
|
||||
$table->dropIndex('users_active_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table) {
|
||||
$table->dropIndex('contacts_created_at_id_idx');
|
||||
$table->dropIndex('contacts_portal_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table) {
|
||||
$table->dropIndex('companies_active_created_at_id_idx');
|
||||
$table->dropIndex('companies_created_at_id_idx');
|
||||
});
|
||||
|
||||
Schema::table('press_releases', function (Blueprint $table) {
|
||||
$table->dropIndex('press_releases_status_created_at_id_idx');
|
||||
$table->dropIndex('press_releases_created_at_id_idx');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! $this->supportsFullTextIndexes()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('press_releases', function (Blueprint $table): void {
|
||||
$table->fullText(['title', 'keywords'], 'press_releases_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
$table->fullText(['name', 'email', 'slug'], 'companies_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table): void {
|
||||
$table->fullText(['first_name', 'last_name', 'email', 'responsibility'], 'contacts_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->fullText(['name', 'email'], 'users_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('category_translations', function (Blueprint $table): void {
|
||||
$table->fullText(['name', 'slug'], 'category_translations_admin_search_fulltext');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (! $this->supportsFullTextIndexes()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::table('category_translations', function (Blueprint $table): void {
|
||||
$table->dropFullText('category_translations_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('contacts', function (Blueprint $table): void {
|
||||
$table->dropFullText('contacts_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('users', function (Blueprint $table): void {
|
||||
$table->dropFullText('users_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('companies', function (Blueprint $table): void {
|
||||
$table->dropFullText('companies_admin_search_fulltext');
|
||||
});
|
||||
|
||||
Schema::table('press_releases', function (Blueprint $table): void {
|
||||
$table->dropFullText('press_releases_admin_search_fulltext');
|
||||
});
|
||||
}
|
||||
|
||||
private function supportsFullTextIndexes(): bool
|
||||
{
|
||||
return in_array(DB::connection()->getDriverName(), ['mysql', 'pgsql'], true);
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
use App\Enums\Portal;
|
||||
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('footer_codes', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->enum('portal', array_map(
|
||||
static fn (Portal $portal): string => $portal->value,
|
||||
Portal::cases(),
|
||||
))->default(Portal::Both->value);
|
||||
$table->string('language', 2)->nullable();
|
||||
$table->string('title', 255);
|
||||
$table->text('content');
|
||||
$table->boolean('is_global')->default(false);
|
||||
$table->boolean('is_active')->default(true);
|
||||
$table->unsignedInteger('priority')->default(0);
|
||||
$table->enum('legacy_portal', [
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
])->nullable();
|
||||
$table->unsignedBigInteger('legacy_id')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['legacy_portal', 'legacy_id'], 'footer_codes_legacy_portal_legacy_id_unique');
|
||||
$table->index(['portal', 'language', 'is_active'], 'footer_codes_portal_language_active_idx');
|
||||
$table->index(['is_global', 'is_active'], 'footer_codes_global_active_idx');
|
||||
});
|
||||
|
||||
Schema::create('category_footer_code', function (Blueprint $table): void {
|
||||
$table->foreignId('footer_code_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('category_id')->constrained()->cascadeOnDelete();
|
||||
|
||||
$table->primary(['footer_code_id', 'category_id'], 'category_footer_code_pk');
|
||||
$table->index('category_id', 'category_footer_code_category_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('category_footer_code');
|
||||
Schema::dropIfExists('footer_codes');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
<?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('press_release_status_logs', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->foreignId('press_release_id')
|
||||
->constrained()
|
||||
->cascadeOnDelete();
|
||||
$table->foreignId('changed_by_user_id')
|
||||
->nullable()
|
||||
->constrained('users')
|
||||
->nullOnDelete();
|
||||
$table->string('from_status', 32)->nullable();
|
||||
$table->string('to_status', 32);
|
||||
$table->text('reason')->nullable();
|
||||
$table->string('source', 32)->default('admin');
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
|
||||
$table->index(['press_release_id', 'created_at'], 'pr_status_logs_pr_created_idx');
|
||||
$table->index('to_status', 'pr_status_logs_to_status_idx');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('press_release_status_logs');
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?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('legacy_invoices', function (Blueprint $table) {
|
||||
$table->json('pdf_payload')->nullable()->after('raw_snapshot');
|
||||
$table->timestamp('pdf_generated_at')->nullable()->after('pdf_payload');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('legacy_invoices', function (Blueprint $table) {
|
||||
$table->dropColumn(['pdf_payload', 'pdf_generated_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue