This commit is contained in:
2023-11-26 18:56:40 +08:00
parent be14f5fdb1
commit 64431e7a73
144 changed files with 497072 additions and 3730 deletions

View File

@@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('CREATE EXTENSION IF NOT EXISTS vector');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('DROP EXTENSION vector');
}
};

View File

@@ -13,22 +13,16 @@ public function up(): void
{
Schema::create('categories', function (Blueprint $table) {
$table->id();
$table->enum('type', ['review', 'launch', 'deals'])->default('review');
$table->foreignId('country_locale_id');
$table->string('country_locale_slug')->default('my');
$table->string('name')->nullable();
$table->string('short_name')->nullable();
$table->string('name');
$table->string('emoji')->nullable();
$table->string('slug')->nullable();
$table->mediumText('description')->nullable();
$table->boolean('enabled')->default(true);
$table->boolean('is_top')->default(true);
$table->boolean('is_top')->default(false);
$table->nestedSet();
$table->softDeletes();
$table->timestamps();
$table->foreign('country_locale_id')->references('id')->on('country_locales');
$table->foreign('country_locale_slug')->references('slug')->on('country_locales');
});
}

View File

@@ -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('url_to_crawls', function (Blueprint $table) {
$table->id();
$table->string('domain');
$table->string('url');
$table->boolean('is_crawling')->default(false);
$table->boolean('is_crawled')->default(false);
$table->enum('output_type', ['html', 'markdown', 'file'])->nullable();
$table->text('output')->nullable();
$table->json('metadata')->nullable();
$table->enum('status', ['initial', 'complete', 'blocked', 'trashed'])->default('initial');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('url_to_crawls');
}
};

View File

@@ -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('service_cost_usages', function (Blueprint $table) {
$table->id();
$table->double('cost', 5, 5);
$table->string('name');
$table->string('reference_1')->nullable();
$table->string('reference_2')->nullable();
$table->jsonb('output');
$table->text('input_1')->nullable();
$table->text('input_2')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('service_cost_usages');
}
};

View File

@@ -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('ai_tools', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id');
$table->foreignId('url_to_crawl_id');
$table->string('screenshot_img')->nullable();
$table->boolean('is_ai_tool')->default(true);
$table->string('tool_name');
$table->string('is_app_web_both');
$table->text('tagline')->nullable();
$table->text('summary')->nullable();
$table->string('pricing_type');
$table->mediumText('keyword_string')->nullable();
$table->jsonb('qna')->nullable();
$table->timestamps();
$table->foreign('category_id')->references('id')->on('categories');
$table->foreign('url_to_crawl_id')->references('id')->on('url_to_crawls');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ai_tools');
}
};

View File

@@ -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('ai_tool_keywords', function (Blueprint $table) {
$table->id();
$table->foreignId('category_id');
$table->foreignId('ai_tool_id');
$table->string('value');
$table->string('value_lowercased');
$table->timestamps();
$table->foreign('category_id')->references('id')->on('categories');
$table->foreign('ai_tool_id')->references('id')->on('ai_tools');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('ai_tool_keywords');
}
};

View File

@@ -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('search_embeddings', function (Blueprint $table) {
$table->id();
$table->enum('type', ['ai_tool', 'ai_tool_keyword', 'qna']);
$table->foreignId('category_id')->nullable();
$table->foreignId('ai_tool_id')->nullable();
$table->text('query');
$table->vector('embedding', 384)->nullable();
$table->timestamps();
$table->foreign('ai_tool_id')->references('id')->on('ai_tools');
$table->foreign('category_id')->references('id')->on('categories');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('search_embeddings');
}
};