Use this skill whenever working with Prev* models, the mysql_prev database connection, legacy services (LegacyMembershipResolverService, PrevClubMembershipResolverService, PedigreeTreeBuilderService, BreedingDogCheckService, PrevDogBreedingRightsService), or any Filament/Livewire screen that touches legacy dog, user, club, breeding, or show data. Covers: non-standard owner-key joins, decimal-as-code columns, dual ownership semantics, cast/enum/accessor patterns, Shield + policy authorization, and upgrade/migration risks. Do not use for purely modern-app concerns (User model, Spatie roles, Redis, Horizon).
Activate this skill any time you are:
Prev* models or mysql_prev queriesapp/Livewire/Legacyapp/Services/LegacyRead the relevant file before making changes:
references/architecture.md — app split, domain groupings, panels, builders/casts/enums/observers, policies, upgrade
risks and migration sequencereferences/legacy-data.md — full table/model/column mapping, owner-key rules, decimal-as-code rules, all
mysql_prev tables inventoryreferences/filament-shield.md — Filament resource families, Livewire coupling, Blade files, Shield + policy layer,
upgrade checklistThe legacy schema does not use id -> *_id conventions throughout. Always verify the join via the model relation
before writing a query.
Key non-standard joins already in production:
| Column | Joins to |
|---|---|
DogsDB.RaceID | BreedsDB.BreedCode |
DogsDB.ColorID | ColorsDB.OldCode |
DogsDB.HairID | HairsDB.OldCode |
DogsDB.CurrentOwnerId | users.owner_code |
DogsDB.FatherSAGIR / MotherSAGIR | DogsDB.SagirID |
DogsDB.BeitGidulID | breedinghouses.GidulCode |
Shows_Breeds.RaceID | BreedsDB.BreedCode |
shows_results (arena) | uses MainArenaID, not ArenaID |
Many mysql_prev columns are stored as decimal(28,8) but act as integer-like business codes.
Examples: SagirID, RaceID, ColorID, HairID, CurrentOwnerId, BreedCode, OldCode, ClubCode, GidulCode.
Never cast these to true decimals for arithmetic. The app normalizes them through casts or accessors.
PrevUser.id and PrevUser.owner_code are different identifiersPrevUser.id — row PK; used in pivot tables and most direct relationsPrevUser.owner_code — legacy business owner key; used by PrevDog::legacyOwner()Confusing them produces wrong owner results silently.
PrevDog has dual ownership semanticsdogs2users pivot (SagirID + user_id)CurrentOwnerId -> owner_codeAny change to ownership logic must preserve both paths or explicitly define a cutover rule.
app/Casts/Legacy/* normalize legacy decimal/string encodings into booleans or enumsapp/Observers/PrevBreedObserver.php and PrevDogObserver.php maintain normalization on writefull_name, gender_label, size_label, formatted_label shape all UI outputRemoving any of these without replacement causes silent data corruption or incorrect UI rendering.
Shield provides permission structure and Filament integration. The policies in app/Policies encode record-level
authorization. Both must stay aligned — migrate them together, not separately.
mysql_prev queries in resources and servicesNot all legacy data access goes through Eloquent. PrevShowResource and other areas use DB::connection('mysql_prev')
directly. Always inspect both the model layer and the resource/service layer.
id is the join key in mysql_prevauth()->user()->prevUser is always present — it is a hard runtime dependency in the user panelphp artisan prev:tables — it is currently broken; use Boost database-schema on mysql_prev instead