From 7c5075b188f6c6bf4c4319ea7f2dc0908843d5f1 Mon Sep 17 00:00:00 2001 From: Kyrch Date: Fri, 30 Jan 2026 23:04:49 -0300 Subject: [PATCH] chore!: database changes part 2 (#1072) --- .../Actions/Storage/Wiki/Video/UploadVideoAction.php | 3 +-- app/Filament/Resources/Wiki/Anime/Theme/Entry.php | 4 +++- app/Filament/Resources/Wiki/Video.php | 6 +++--- .../Anime/Theme/Entry/AnimeThemeEntryVersionField.php | 1 - .../Field/Admin/Announcement/AnnouncementEndAtField.php | 1 - .../ExternalProfile/ExternalProfileVisibilityField.php | 1 - .../Field/Wiki/Anime/Theme/Entry/EntryVersionField.php | 1 - app/Models/Auth/Role.php | 9 --------- app/Models/Wiki/Anime/AnimeSynonym.php | 9 --------- app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php | 9 --------- app/Models/Wiki/Song/Performance.php | 9 --------- app/Models/Wiki/Video.php | 9 --------- app/Pivots/Morph/Imageable.php | 9 --------- app/Pivots/Wiki/ArtistMember.php | 9 --------- .../2022_05_09_032230_create_permission_tables.php | 2 +- .../2025_08_16_025830_create_imageables_table.php | 2 +- .../2025_10_25_033138_add_relevance_to_performances.php | 2 +- ...0_30_204112_add_relevance_to_artist_members_table.php | 2 +- lang/en/filament.php | 2 +- 19 files changed, 12 insertions(+), 78 deletions(-) diff --git a/app/Filament/Actions/Storage/Wiki/Video/UploadVideoAction.php b/app/Filament/Actions/Storage/Wiki/Video/UploadVideoAction.php index 77066563e..69764cf06 100644 --- a/app/Filament/Actions/Storage/Wiki/Video/UploadVideoAction.php +++ b/app/Filament/Actions/Storage/Wiki/Video/UploadVideoAction.php @@ -122,8 +122,7 @@ class UploadVideoAction extends UploadAction Select::make(Video::ATTRIBUTE_SOURCE) ->label(__('filament.fields.video.source.name')) ->helperText(__('filament.fields.video.source.help')) - ->options(VideoSource::class) - ->required(), + ->options(VideoSource::class), ]), Section::make(__('filament.resources.singularLabel.video_script')) diff --git a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php index 053d6cfef..0c38fedc2 100644 --- a/app/Filament/Resources/Wiki/Anime/Theme/Entry.php +++ b/app/Filament/Resources/Wiki/Anime/Theme/Entry.php @@ -137,7 +137,9 @@ class Entry extends BaseResource TextInput::make(EntryModel::ATTRIBUTE_VERSION) ->label(__('filament.fields.anime_theme_entry.version.name')) ->helperText(__('filament.fields.anime_theme_entry.version.help')) - ->integer(), + ->default(1) + ->integer() + ->required(), TextInput::make(EntryModel::ATTRIBUTE_EPISODES) ->label(__('filament.fields.anime_theme_entry.episodes.name')) diff --git a/app/Filament/Resources/Wiki/Video.php b/app/Filament/Resources/Wiki/Video.php index f161e08a9..8eb015241 100644 --- a/app/Filament/Resources/Wiki/Video.php +++ b/app/Filament/Resources/Wiki/Video.php @@ -113,13 +113,13 @@ class Video extends BaseResource Select::make(VideoModel::ATTRIBUTE_OVERLAP) ->label(__('filament.fields.video.overlap.name')) ->helperText(__('filament.fields.video.overlap.help')) - ->options(VideoOverlap::class), + ->options(VideoOverlap::class) + ->required(), Select::make(VideoModel::ATTRIBUTE_SOURCE) ->label(__('filament.fields.video.source.name')) ->helperText(__('filament.fields.video.source.help')) - ->options(VideoSource::class) - ->required(), + ->options(VideoSource::class), Select::make(VideoModel::ATTRIBUTE_AUDIO) ->label(__('filament.resources.singularLabel.audio')) diff --git a/app/GraphQL/Schema/Fields/Wiki/Anime/Theme/Entry/AnimeThemeEntryVersionField.php b/app/GraphQL/Schema/Fields/Wiki/Anime/Theme/Entry/AnimeThemeEntryVersionField.php index e1d778b38..3f7799a1a 100644 --- a/app/GraphQL/Schema/Fields/Wiki/Anime/Theme/Entry/AnimeThemeEntryVersionField.php +++ b/app/GraphQL/Schema/Fields/Wiki/Anime/Theme/Entry/AnimeThemeEntryVersionField.php @@ -27,7 +27,6 @@ class AnimeThemeEntryVersionField extends IntField implements CreatableField, Up public function getCreationRules(array $args): array { return [ - 'sometimes', 'required', 'integer', 'min:0', diff --git a/app/Http/Api/Field/Admin/Announcement/AnnouncementEndAtField.php b/app/Http/Api/Field/Admin/Announcement/AnnouncementEndAtField.php index ddc138932..b2c4e9b51 100644 --- a/app/Http/Api/Field/Admin/Announcement/AnnouncementEndAtField.php +++ b/app/Http/Api/Field/Admin/Announcement/AnnouncementEndAtField.php @@ -11,7 +11,6 @@ use App\Http\Api\Field\DateField; use App\Http\Api\Query\Query; use App\Http\Api\Schema\Schema; use App\Models\Admin\Announcement; -use App\Models\Admin\FeaturedTheme; use Illuminate\Http\Request; use Illuminate\Support\Str; diff --git a/app/Http/Api/Field/List/ExternalProfile/ExternalProfileVisibilityField.php b/app/Http/Api/Field/List/ExternalProfile/ExternalProfileVisibilityField.php index 00b8985ad..915234498 100644 --- a/app/Http/Api/Field/List/ExternalProfile/ExternalProfileVisibilityField.php +++ b/app/Http/Api/Field/List/ExternalProfile/ExternalProfileVisibilityField.php @@ -23,7 +23,6 @@ class ExternalProfileVisibilityField extends EnumField implements CreatableField public function getCreationRules(Request $request): array { return [ - 'sometimes', 'required', new Enum(ExternalProfileVisibility::class), ]; diff --git a/app/Http/Api/Field/Wiki/Anime/Theme/Entry/EntryVersionField.php b/app/Http/Api/Field/Wiki/Anime/Theme/Entry/EntryVersionField.php index bc09ad010..9849a143d 100644 --- a/app/Http/Api/Field/Wiki/Anime/Theme/Entry/EntryVersionField.php +++ b/app/Http/Api/Field/Wiki/Anime/Theme/Entry/EntryVersionField.php @@ -21,7 +21,6 @@ class EntryVersionField extends IntField implements CreatableField, UpdatableFie public function getCreationRules(Request $request): array { return [ - 'sometimes', 'required', 'integer', 'min:0', diff --git a/app/Models/Auth/Role.php b/app/Models/Auth/Role.php index 1a8098121..d06337b1e 100644 --- a/app/Models/Auth/Role.php +++ b/app/Models/Auth/Role.php @@ -35,15 +35,6 @@ class Role extends BaseRole implements Nameable final public const string RELATION_PERMISSIONS = 'permissions'; final public const string RELATION_USERS = 'users'; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - Role::ATTRIBUTE_PRIORITY => 0, - ]; - /** * Get the attributes that should be cast. * diff --git a/app/Models/Wiki/Anime/AnimeSynonym.php b/app/Models/Wiki/Anime/AnimeSynonym.php index 7a33bbaea..3e6fe7658 100644 --- a/app/Models/Wiki/Anime/AnimeSynonym.php +++ b/app/Models/Wiki/Anime/AnimeSynonym.php @@ -74,15 +74,6 @@ class AnimeSynonym extends BaseModel implements Auditable, SoftDeletable AnimeSynonym::ATTRIBUTE_TYPE, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - AnimeSynonym::ATTRIBUTE_TYPE => AnimeSynonymType::OTHER->value, - ]; - /** * The event map for the model. * diff --git a/app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php b/app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php index 0b77f01c3..5b76bca12 100644 --- a/app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php +++ b/app/Models/Wiki/Anime/Theme/AnimeThemeEntry.php @@ -137,15 +137,6 @@ class AnimeThemeEntry extends BaseModel implements Auditable, HasAggregateLikes, AnimeThemeEntry::ATTRIBUTE_VERSION, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - AnimeThemeEntry::ATTRIBUTE_VERSION => 1, - ]; - /** * Get the attributes that should be cast. * diff --git a/app/Models/Wiki/Song/Performance.php b/app/Models/Wiki/Song/Performance.php index 653cbd758..7bb30da7d 100644 --- a/app/Models/Wiki/Song/Performance.php +++ b/app/Models/Wiki/Song/Performance.php @@ -100,15 +100,6 @@ class Performance extends BaseModel implements Auditable, SoftDeletable Performance::ATTRIBUTE_RELEVANCE, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - Performance::ATTRIBUTE_RELEVANCE => 1, - ]; - public function getName(): string { return strval($this->getKey()); diff --git a/app/Models/Wiki/Video.php b/app/Models/Wiki/Video.php index b2649c450..731f48e89 100644 --- a/app/Models/Wiki/Video.php +++ b/app/Models/Wiki/Video.php @@ -159,15 +159,6 @@ class Video extends BaseModel implements Auditable, HasAggregateViews, SoftDelet Video::ATTRIBUTE_TAGS, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - Video::ATTRIBUTE_OVERLAP => VideoOverlap::NONE->value, - ]; - /** * Get the attributes that should be cast. * diff --git a/app/Pivots/Morph/Imageable.php b/app/Pivots/Morph/Imageable.php index d59fa238e..2c4e260df 100644 --- a/app/Pivots/Morph/Imageable.php +++ b/app/Pivots/Morph/Imageable.php @@ -86,15 +86,6 @@ class Imageable extends BaseMorphPivot Imageable::ATTRIBUTE_IMAGEABLE_ID, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - Imageable::ATTRIBUTE_DEPTH => 1, - ]; - /** * Get the attributes that should be cast. * diff --git a/app/Pivots/Wiki/ArtistMember.php b/app/Pivots/Wiki/ArtistMember.php index f96712614..23272e72b 100644 --- a/app/Pivots/Wiki/ArtistMember.php +++ b/app/Pivots/Wiki/ArtistMember.php @@ -72,15 +72,6 @@ class ArtistMember extends BasePivot ArtistMember::ATTRIBUTE_RELEVANCE, ]; - /** - * The model's default values for attributes. - * - * @var array - */ - protected $attributes = [ - ArtistMember::ATTRIBUTE_RELEVANCE => 1, - ]; - /** * Get the composite primary key for the pivot. * diff --git a/database/migrations/2022_05_09_032230_create_permission_tables.php b/database/migrations/2022_05_09_032230_create_permission_tables.php index 8b9084d91..92a26e663 100644 --- a/database/migrations/2022_05_09_032230_create_permission_tables.php +++ b/database/migrations/2022_05_09_032230_create_permission_tables.php @@ -49,7 +49,7 @@ return new class extends Migration $table->string('guard_name'); // For MyISAM use string('guard_name', 25); $table->boolean('default')->default(false); $table->string('color')->nullable(); - $table->integer('priority'); + $table->integer('priority')->default(0); $table->timestamps(); if ($teams || config('permission.testing')) { $table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']); diff --git a/database/migrations/2025_08_16_025830_create_imageables_table.php b/database/migrations/2025_08_16_025830_create_imageables_table.php index 9fb41b0dd..25231f915 100644 --- a/database/migrations/2025_08_16_025830_create_imageables_table.php +++ b/database/migrations/2025_08_16_025830_create_imageables_table.php @@ -19,7 +19,7 @@ return new class extends Migration $table->foreign('image_id')->references('image_id')->on('images')->cascadeOnDelete(); $table->morphs('imageable'); - $table->integer('depth'); + $table->integer('depth')->default(1); $table->timestamps(6); diff --git a/database/migrations/2025_10_25_033138_add_relevance_to_performances.php b/database/migrations/2025_10_25_033138_add_relevance_to_performances.php index bfb45a969..8a35c1703 100644 --- a/database/migrations/2025_10_25_033138_add_relevance_to_performances.php +++ b/database/migrations/2025_10_25_033138_add_relevance_to_performances.php @@ -15,7 +15,7 @@ return new class extends Migration { if (! Schema::hasColumn('performances', 'relevance')) { Schema::table('performances', function (Blueprint $table) { - $table->integer('relevance')->after('as'); + $table->integer('relevance')->default(1)->after('as'); }); } } diff --git a/database/migrations/2025_10_30_204112_add_relevance_to_artist_members_table.php b/database/migrations/2025_10_30_204112_add_relevance_to_artist_members_table.php index 04f74e00b..fb2f7ba70 100644 --- a/database/migrations/2025_10_30_204112_add_relevance_to_artist_members_table.php +++ b/database/migrations/2025_10_30_204112_add_relevance_to_artist_members_table.php @@ -15,7 +15,7 @@ return new class extends Migration { if (! Schema::hasColumn('artist_member', 'relevance')) { Schema::table('artist_member', function (Blueprint $table) { - $table->integer('relevance')->nullable(); + $table->integer('relevance')->default(1)->nullable(); }); } } diff --git a/lang/en/filament.php b/lang/en/filament.php index 0c549f44b..d4f65861e 100644 --- a/lang/en/filament.php +++ b/lang/en/filament.php @@ -562,7 +562,7 @@ return [ 'name' => 'Spoiler', ], 'version' => [ - 'help' => 'The Version number of the Theme. Can be left blank if there is only one version. Version is only required if there exist at least 2 in the sequence.', + 'help' => 'The Version number of the Theme.', 'name' => 'Version', ], 'youtube' => [