Adjusts migration constraints

This commit is contained in:
Refringe 2024-06-27 00:13:12 -04:00
parent 56b1f3e523
commit aae4a7e7ea
Signed by: Refringe
SSH Key Fingerprint: SHA256:t865XsQpfTeqPRBMN2G6+N8wlDjkgUCZF3WGW6O9N/k
4 changed files with 42 additions and 9 deletions

View File

@ -14,12 +14,20 @@ return new class extends Migration
{
Schema::create('users', function (Blueprint $table) {
$table->id();
$table->bigInteger('hub_id')->nullable()->default(null)->unique();
$table->bigInteger('hub_id')
->nullable()
->default(null)
->unique();
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->foreignIdFor(UserRole::class)->nullable()->default(null)->constrained('user_roles');
$table->foreignIdFor(UserRole::class)
->nullable()
->default(null)
->constrained('user_roles')
->nullOnDelete()
->cascadeOnUpdate();
$table->rememberToken();
$table->string('profile_photo_path', 2048)->nullable();
$table->timestamps();

View File

@ -12,14 +12,25 @@ return new class extends Migration
{
Schema::create('mods', function (Blueprint $table) {
$table->id();
$table->bigInteger('hub_id')->nullable()->default(null)->unique();
$table->foreignIdFor(User::class)->constrained('users');
$table->bigInteger('hub_id')
->nullable()
->default(null)
->unique();
$table->foreignIdFor(User::class)
->constrained('users')
->cascadeOnDelete()
->cascadeOnUpdate();
$table->string('name');
$table->string('slug');
$table->string('teaser');
$table->longText('description');
$table->string('thumbnail')->default('');
$table->foreignIdFor(License::class)->nullable()->default(null)->constrained('licenses');
$table->foreignIdFor(License::class)
->nullable()
->default(null)
->constrained('licenses')
->nullOnDelete()
->cascadeOnUpdate();
$table->string('source_code_link');
$table->boolean('featured')->default(false);
$table->boolean('contains_ai_content')->default(false);

View File

@ -10,7 +10,10 @@ return new class extends Migration
{
Schema::create('spt_versions', function (Blueprint $table) {
$table->id();
$table->bigInteger('hub_id')->nullable()->default(null)->unique();
$table->bigInteger('hub_id')
->nullable()
->default(null)
->unique();
$table->string('version');
$table->string('color_class');
$table->softDeletes();

View File

@ -12,12 +12,23 @@ return new class extends Migration
{
Schema::create('mod_versions', function (Blueprint $table) {
$table->id();
$table->bigInteger('hub_id')->nullable()->default(null)->unique();
$table->foreignIdFor(Mod::class)->constrained('mods');
$table->bigInteger('hub_id')
->nullable()
->default(null)
->unique();
$table->foreignIdFor(Mod::class)
->constrained('mods')
->cascadeOnDelete()
->cascadeOnUpdate();
$table->string('version');
$table->longText('description');
$table->string('link');
$table->foreignIdFor(SptVersion::class)->constrained('spt_versions');
$table->foreignIdFor(SptVersion::class)
->nullable()
->default(null)
->constrained('spt_versions')
->nullOnDelete()
->cascadeOnUpdate();
$table->string('virus_total_link');
$table->unsignedBigInteger('downloads');
$table->boolean('disabled')->default(false);