Prepare component

This commit is contained in:
2025-05-30 01:07:33 -06:00
parent 3916c62935
commit cac9a5b121
263 changed files with 14456 additions and 1072 deletions

View File

@ -0,0 +1,77 @@
<?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('website_seo_profiles', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->nullable()->index();
// Metadata
$table->string('type', 16)->default('page')->index(); // Enum: Content, Landing, Product, Category Blog
$table->string('title')->nullable()->index(); // Título del perfil
$table->string('slug')->unique();
$table->mediumText('description')->nullable(); // Descripción del perfil
// Tipos de schema adicionales
$table->json('schema_org')->nullable();
// Robots Directives
$table->boolean('noindex')->default(false);
$table->boolean('nofollow')->default(false);
// Idioma y Geolocalización
$table->string('locale', 8)->default('es-MX')->index(); // Para SEO internacional
$table->json('geo_location')->nullable(); // meta geo.region y geo.placename
// Open Graph
$table->string('og_type')->nullable();
$table->string('og_title')->nullable();
$table->text('og_description')->nullable();
$table->string('og_image')->nullable();
$table->string('og_url')->nullable();
$table->string('og_site_name')->nullable();
// Twitter Card
$table->string('twitter_card')->default('summary_large_image');
$table->string('twitter_title')->nullable();
$table->text('twitter_description')->nullable();
$table->string('twitter_image')->nullable();
$table->string('twitter_site')->nullable();
$table->string('twitter_creator')->nullable();
// JSON-LD opcional (almacenado como bloque JSON)
$table->json('json_ld')->nullable();
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable();
$table->unsignedMediumInteger('updated_by')->nullable();
$table->timestamps();
// Indices
$table->index(['site_id', 'type']);
$table->index(['site_id', 'type', 'slug']);
// Relaciones
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_seo_profiles');
}
};

View File

@ -0,0 +1,64 @@
<?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('website_sites', function (Blueprint $table) {
$table->smallIncrements('id');
// Identidad
$table->string('name')->index(); // Nombre visible en admin
$table->string('slug')->unique(); // Clave técnica
$table->string('domain')->unique(); // Dominio principal (sin protocolo)
$table->string('template')->nullable(); // Componente layout activo
// Estado
$table->string('status', 16)->default('active')->index(); // Estados especiales del sitio
$table->boolean('is_indexable')->default(true)->index(); // SEO: permitir indexado o no
// SEO
$table->unsignedSmallInteger('seo_profile_id')->nullable()->index();
$table->string('canonical_url')->nullable(); // Canonical para root
// Configuración
$table->json('config')->nullable(); // favicon, theme, brand, CDN, etc.
// Auditoría
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['slug', 'status', 'is_indexable']);
// Relaciones
$table->foreign('seo_profile_id')->references('id')->on('website_seo_profiles')->nullOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
Schema::table('website_seo_profiles', function (Blueprint $table) {
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_sites');
Schema::table('website_seo_profiles', function (Blueprint $table) {
$table->dropForeign(['site_id']);
});
}
};

View File

@ -0,0 +1,48 @@
<?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('website_menus', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->index();
$table->string('title')->index();
$table->string('slug')->unique();
$table->string('description')->nullable();
$table->boolean('is_active')->default(true)->index();
// Auditoría
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['site_id', 'slug', 'is_active']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_menus');
}
};

View File

@ -0,0 +1,75 @@
<?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('website_menu_items', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('menu_id')->index();
$table->unsignedSmallInteger('parent_id')->nullable()->index();
$table->json('title'); // i18n multilanguage
$table->string('type', 16)->default('cms_page')->index(); // Enum; cms_page | url | laravel_route | blog_article | Evento Json
// Construcción de enlace
$table->unsignedMediumInteger('linkable_id')->nullable()->index(); // Relación polimórfica con:
$table->string('linkable_type')->nullable()->index(); // páginas, entradas, productos, etc.
$table->string('laravel_route')->nullable()->index();
$table->string('url')->nullable()->index();
$table->string('method')->nullable();
$table->string('target', 16)->nullable(); // Enum _self, _blank, etc.
$table->string('js_event')->nullable();
// UI
$table->string('icon')->nullable();
$table->string('badge')->nullable();
$table->string('badge_color')->nullable();
// Visibilidad
$table->json('roles')->nullable();
$table->json('permissions')->nullable();
$table->boolean('hide_if_authenticated')->default(false)->index();
$table->boolean('hide_if_guest')->default(false)->index();
$table->timestamp('visible_from')->nullable();
$table->timestamp('visible_until')->nullable();
$table->unsignedSmallInteger('order')->default(0); // Para ordenar en el menú
$table->boolean('is_active')->default(true)->index();
// Auditoría
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['menu_id', 'is_active']);
$table->index(['menu_id', 'parent_id', 'is_active']);
$table->index(['linkable_id', 'linkable_type']);
// Relaciones
$table->foreign('menu_id')->references('id')->on('website_menus')->cascadeOnDelete();
$table->foreign('parent_id')->references('id')->on('website_menu_items')->nullOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_menu_items');
}
};

View File

@ -0,0 +1,84 @@
<?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('website_contents', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->index();
$table->unsignedSmallInteger('seo_profile_id')->nullable()->index();
// Metadata
$table->string('title')->index();
$table->string('slug')->unique();
$table->string('description');
$table->json('keywords')->nullable();
// Template & Type content
$table->string('template')->nullable();
$table->string('template_variant')->nullable();
$table->string('type', 16)->default('page')->index(); // Enum: Content, Landing, Product, Category Blog, Partial
$table->string('render_mode', 16)->default('static');
$table->string('block_mode', 16)->default('db');
$table->string('source', 16)->default('db');
$table->string('render_as')->nullable();
//canonical url
$table->string('canonical_url')->nullable();
// Content
$table->json('content_blocks')->nullable(); // Bloques estructurados
$table->json('seo_overrides')->nullable();
// Control
$table->boolean('is_draft')->default(true)->index();
$table->boolean('is_sensitive')->default(false)->index(); // Allow dangerous Blade content
$table->boolean('is_partial')->default(false)->index();
// Visibilidad
$table->json('roles')->nullable();
$table->json('permissions')->nullable();
$table->boolean('hide_if_authenticated')->default(false)->index();
$table->boolean('hide_if_guest')->default(false)->index();
$table->timestamp('visible_from')->nullable();
$table->timestamp('visible_until')->nullable();
// Cache
$table->boolean('enable_cache')->default(true)->index();
$table->unsignedSmallInteger('cache_ttl')->default(60); // minutos
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['site_id', 'type']);
$table->index(['site_id', 'type', 'slug']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('seo_profile_id')->references('id')->on('website_seo_profiles')->nullOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_contents');
}
};

View File

@ -0,0 +1,48 @@
<?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('website_content_blocks', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('content_id')->index();
$table->unsignedSmallInteger('parent_id')->nullable()->index();
$table->string('slug')->nullable();
$table->string('type', 32);
$table->string('mode', 16)->default('view');
$table->string('view_path')->nullable();
$table->string('component_class')->nullable();
$table->boolean('is_enabled')->default(true);
$table->boolean('enable_cache')->default(true);
$table->unsignedSmallInteger('cache_ttl')->default(60);
$table->json('settings')->nullable();
$table->json('data')->nullable();
$table->unsignedSmallInteger('order')->default(0);
$table->timestamps();
$table->foreign('content_id')->references('id')->on('website_contents')->cascadeOnDelete();
$table->foreign('parent_id')->references('id')->on('website_content_blocks')->nullOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_content_blocks');
}
};

View File

@ -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('website_content_versions', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('website_content_id')->index();
$table->string('version_label')->nullable();
$table->longText('content');
$table->json('metadata')->nullable();
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable();
$table->unsignedMediumInteger('updated_by')->nullable();
$table->timestamps();
// Relaciones
$table->foreign('website_content_id')->references('id')->on('website_contents')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('website_content_versions');
}
};

View File

@ -0,0 +1,44 @@
<?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('sitemap_profiles', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->index(); // Soporte multisite
$table->string('name'); // Nombre del perfil: 'Productos', 'Páginas CMS'
$table->string('slug')->unique(); // Clave técnica
$table->string('entity_type')->nullable(); // Ej: App\Models\Product
$table->string('generator_class')->nullable(); // Clase que implementa SitemapUrlGeneratorInterface
$table->boolean('is_active')->default(true)->index();
// Auditoría
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['site_id', 'slug']);
$table->index(['site_id', 'slug', 'is_active']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('sitemap_profiles');
}
};

View File

@ -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('sitemap_rules', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->unsignedSmallInteger('sitemap_profile_id')->index();
$table->string('rule_type'); // Ej: 'priority_override', 'exclude_flag', etc.
$table->json('rule_data'); // JSON con parámetros
$table->timestamps();
// Indices
$table->index(['sitemap_profile_id', 'rule_type']);
// Relaciones
$table->foreign('sitemap_profile_id')->references('id')->on('sitemap_profiles')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('sitemap_rules');
}
};

View File

@ -12,13 +12,26 @@ return new class extends Migration
public function up(): void
{
Schema::create('sitemap_urls', function (Blueprint $table) {
$table->id();
$table->mediumIncrements('id');
$table->unsignedSmallInteger('sitemap_profile_id')->index();
$table->string('url')->unique();
$table->enum('changefreq', ['always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly'])->default('weekly');
$table->string('changefreq', 16)->default('weekly'); // Enum
$table->decimal('priority', 2, 1)->default(0.5);
$table->timestamp('lastmod')->nullable();
$table->boolean('is_active')->default(true);
$table->boolean('is_active')->default(true)->index();
$table->json('alternate_locales')->nullable(); // SEO internacional
// Auditoría
$table->timestamps();
// Indices
$table->index(['sitemap_profile_id', 'is_active']);
// Relaciones
$table->foreign('sitemap_profile_id')->references('id')->on('sitemap_profiles')->cascadeOnDelete();
});
}

View File

@ -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('sitemap_index_files', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->unsignedSmallInteger('sitemap_profile_id')->index();
$table->string('file_name')->unique();
$table->string('url');
$table->timestamp('generated_at');
$table->integer('url_count')->default(0);
$table->boolean('is_current')->default(true);
$table->timestamps();
$table->foreign('sitemap_profile_id')->references('id')->on('sitemap_profiles')->cascadeOnDelete();
});
}
public function down(): void
{
Schema::dropIfExists('sitemap_index_files');
}
};

View File

@ -14,13 +14,27 @@ return new class extends Migration
Schema::create('faq_categories', function (Blueprint $table) {
$table->smallIncrements('id');
$table->string('name')->unique();
$table->unsignedSmallInteger('site_id')->index(); // Soporte multisite
$table->string('name')->index();
$table->string('icon')->nullable();
$table->unsignedInteger('order')->default(0)->index();
$table->boolean('is_active')->default(true)->index();
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->unique(['name', 'site_id']);
$table->index(['name', 'is_active', 'site_id']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}

View File

@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void
{
Schema::create('faqs', function (Blueprint $table) {
$table->id();
$table->smallIncrements('id');
$table->unsignedSmallInteger('category_id')->nullable()->index();
$table->string('question');
@ -21,10 +21,18 @@ return new class extends Migration
$table->boolean('is_active')->default(true)->index();
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->index(['category_id', 'is_active']);
// Relaciones
$table->foreign('category_id')->references('id')->on('faq_categories')->nullOnDelete();
$table->foreign('category_id')->references('id')->on('faq_categories')->restrictOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}

View File

@ -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::create('blog_categories', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->index(); // Soporte multisite
$table->string('name')->index();
$table->string('slug')->index();
$table->string('full_slug')->nullable()->index(); // NUEVO: Ruta cacheada
$table->unsignedSmallInteger('parent_id')->nullable()->index();
$table->string('icon')->nullable(); // NUEVO: Soporte para icono
$table->string('group')->nullable()->index(); // NUEVO: Soporte para agrupación (ej: blog, noticias, promociones)
$table->text('description')->nullable();
$table->boolean('is_active')->default(true)->index();
// Auditoría
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Relaciones
$table->foreign('parent_id')->references('id')->on('blog_categories')->nullOnDelete();
// Indices
$table->index(['name', 'is_active', 'site_id']);
$table->unique(['slug', 'site_id']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_categories');
}
};

View File

@ -0,0 +1,48 @@
<?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('blog_tags', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('site_id')->index(); // Soporte multisite
$table->string('name')->index();
$table->string('slug')->index();
$table->boolean('is_active')->default(true)->index();
// Auditoria
$table->unsignedMediumInteger('created_by')->nullable()->index();
$table->unsignedMediumInteger('updated_by')->nullable()->index();
$table->timestamps();
// Indices
$table->unique(['slug', 'site_id']);
$table->index(['name', 'is_active']);
// Relaciones
$table->foreign('site_id')->references('id')->on('website_sites')->cascadeOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_tags');
}
};

View File

@ -0,0 +1,53 @@
<?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('blog_articles', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('category_id')->index();
$table->string('title')->index();
$table->string('slug')->index();
$table->text('excerpt')->nullable();
$table->longText('content');
$table->json('metadata')->nullable();
$table->boolean('is_published')->default(false)->index();
$table->timestamp('published_at')->nullable()->index();
$table->unsignedMediumInteger('created_by')->index();
$table->unsignedMediumInteger('updated_by')->index();
// Auditoria
$table->timestamps();
// Indices
$table->unique(['slug', 'category_id']);
$table->index(['title', 'is_published']);
// Relaciones
$table->foreign('category_id')->references('id')->on('blog_categories')->restrictOnDelete();
$table->foreign('created_by')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_articles');
}
};

View File

@ -0,0 +1,39 @@
<?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('blog_article_tag', function (Blueprint $table) {
$table->smallIncrements('id');
$table->unsignedSmallInteger('blog_article_id')->index();
$table->unsignedSmallInteger('blog_tag_id')->index();
// Auditoria
$table->timestamps();
// Indices
$table->index(['blog_article_id', 'blog_tag_id']);
// Relaciones
$table->foreign('blog_article_id')->references('id')->on('blog_articles')->cascadeOnDelete();
$table->foreign('blog_tag_id')->references('id')->on('blog_tags')->cascadeOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_article_tag');
}
};

View File

@ -0,0 +1,47 @@
<?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('blog_comments', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->unsignedSmallInteger('blog_article_id')->index();
$table->unsignedMediumInteger('author_id')->nullable()->index();
$table->string('author_name')->index();
$table->string('author_email')->index();
$table->text('comment');
$table->boolean('is_approved')->default(false)->index();
// Auditoria
$table->unsignedMediumInteger('updated_by')->index();
$table->timestamps();
// Indices
$table->index(['blog_article_id', 'is_approved']);
// Relaciones
$table->foreign('blog_article_id')->references('id')->on('blog_articles')->restrictOnDelete();
$table->foreign('author_id')->references('id')->on('users')->restrictOnDelete();
$table->foreign('updated_by')->references('id')->on('users')->restrictOnDelete();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('blog_comments');
}
};

View File

@ -1,23 +0,0 @@
<?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('sitemap_configurations', function (Blueprint $table) {
$table->id();
$table->string('route');
$table->boolean('include')->default(true);
$table->decimal('priority', 2, 1)->default(0.5);
$table->timestamps();
});
}
public function down(): void
{
Schema::dropIfExists('sitemap_configurations');
}
};