Skip to content

Commit

Permalink
[Update] Studio Schema
Browse files Browse the repository at this point in the history
- Added `alternative_names` column
- Added `defunct_at` column
- Added `japanese_name` column
- Added `social_urls` column
- Added `success_id` column
- Renamed `founded` to `founded_at` for consistency
  • Loading branch information
kiritokatklian committed Sep 15, 2024
1 parent 428fbd8 commit 0b6d54b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion database/migrations/2018_08_17_102447_create_studios_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,23 @@ public function up(): void
{
Schema::create(Studio::TABLE_NAME, function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('successor_id')->nullable();
$table->unsignedBigInteger('tv_rating_id')->nullable();
$table->unsignedInteger('mal_id')->nullable();
$table->unsignedTinyInteger('type');
$table->string('slug');
$table->string('name');
$table->string('japanese_name')->nullable();
$table->json('alternative_names')->nullable();
$table->mediumText('about')->nullable();
$table->mediumText('address')->nullable();
$table->date('founded')->nullable();
$table->json('social_urls')->nullable();
$table->json('website_urls')->nullable();
$table->boolean('is_nsfw')->default(false);
$table->unsignedBigInteger('rank_total')->default(0);
$table->integer('view_count')->default(0);
$table->date('founded_at')->nullable();
$table->date('defunct_at')->nullable();
$table->timestamps();
$table->softDeletes();
});
Expand All @@ -43,6 +48,11 @@ public function up(): void
$table->unique(['mal_id', 'type', 'name']);

// Set foreign key constraints
$table->foreign('successor_id')
->references('id')
->on(Studio::TABLE_NAME)
->nullOnDelete()
->cascadeOnUpdate();
$table->foreign('tv_rating_id')
->references('id')
->on(TvRating::TABLE_NAME)
Expand Down

0 comments on commit 0b6d54b

Please sign in to comment.