This commit is contained in:
Azaria
2026-02-19 17:45:54 +00:00
commit bbb42896ba
33 changed files with 9956 additions and 0 deletions
@@ -0,0 +1,30 @@
<?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('username')->index();
$table->string('discord_id')->index()->unique();
$table->boolean('is_admin')->default(false);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('users');
}
};
@@ -0,0 +1,33 @@
<?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');
}
};
@@ -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('emotes', function (Blueprint $table) {
$table->id();
$table->string('emote_id')->unique();
$table->unsignedBigInteger('guild_id')->index();
$table->string('emote_name');
$table->enum('type', ['STATIC', 'ANIMATED', 'UNICODE']);
$table->timestamps();
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('emotes');
}
};
@@ -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('emote_logs', function (Blueprint $table) {
$table->id();
$table->string('emote_id');
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('guild_id')->index();
$table->unsignedBigInteger('channel_id');
$table->unsignedBigInteger('message_id');
$table->boolean('emoji_unicode')->default(false);
$table->timestamps();
$table->foreign('emote_id')
->references('emote_id')
->on('emotes')
->onDelete('cascade');
$table->index(['guild_id', 'emote_id']);
$table->index(['guild_id', 'user_id']);
$table->index(['guild_id', 'message_id']);
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('emote_logs');
}
};
@@ -0,0 +1,43 @@
<?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('emote_guild_stats', function (Blueprint $table) {
$table->id();
$table->string('emote_id');
$table->unsignedBigInteger('guild_id');
$table->unsignedBigInteger('usage_count')->default(0);
$table->timestamps();
$table->foreign('emote_id')
->references('emote_id')
->on('emotes')
->onDelete('cascade');
$table->unique(['emote_id', 'guild_id']);
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('emote_guild_stats');
}
};
@@ -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('user_guild_stats', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('user_id');
$table->unsignedBigInteger('guild_id');
$table->string('emote_id');
$table->unsignedBigInteger('usage_count')->default(0);
$table->timestamps();
$table->foreign('emote_id')
->references('emote_id')
->on('emotes')
->onDelete('cascade');
$table->unique(['user_id', 'guild_id', 'emote_id']);
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('user_guild_stats');
}
};